#include<iostream>
#include<vector>
using namespace std;
const long long maxwei = 1e11;
int n,limit, wei,val,sumval;
int main(){
cin >> n >> limit;
vector<long long> Max(100001, maxwei);
Max[0] = 0;
for (int i = 0; i < n; ++i){
cin >> wei >> val;
sumval+=val;
for (int j = sumval; j >= val; --j)
Max[j]= min(Max[j], Max[j - val] + wei);
}
for(val= sumval; val>0; --val){
if(Max[val]<=limit)
return cout<<val, 0;
}
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPHZlY3Rvcj4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY29uc3QgbG9uZyBsb25nIG1heHdlaSA9IDFlMTE7CmludCBuLGxpbWl0LCB3ZWksdmFsLHN1bXZhbDsKaW50IG1haW4oKXsKICAgIGNpbiA+PiBuID4+IGxpbWl0OwoKICAgIHZlY3Rvcjxsb25nIGxvbmc+IE1heCgxMDAwMDEsIG1heHdlaSk7CiAgICBNYXhbMF0gPSAwOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpewogICAgICAgIGNpbiA+PiB3ZWkgPj4gdmFsOwogICAgICAgIHN1bXZhbCs9dmFsOwogICAgICAgIGZvciAoaW50IGogPSBzdW12YWw7IGogPj0gdmFsOyAtLWopCiAgICAgICAgICAgIE1heFtqXT0gbWluKE1heFtqXSwgTWF4W2ogLSB2YWxdICsgd2VpKTsKICAgIH0KCWZvcih2YWw9IHN1bXZhbDsgdmFsPjA7IC0tdmFsKXsKICAgIAlpZihNYXhbdmFsXTw9bGltaXQpCiAgICAgICAgICAgIHJldHVybiBjb3V0PDx2YWwsIDA7Cgl9Cn0=