// Take care of mod becoming -ve


#include<bits/stdc++.h>
#define fro(i,s,e) for(auto i=s;i<=e;++i)
#define int long long
#define ld long double
#define fr(i,n) for(auto i=0;i<n;i++)
#define ff first
#define ss second
#define mp make_pair
#define vi std::vector<int>
#define mii map<int,int>
#define setbits(x) __builtin_popcountll(x)
#define zrbits(x) __builtin_ctzll(x)
#define vii std::vector<int,int>
#define tc int t;cin>>t;while(t--)
#define FILE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inp(a) long long a;cin>>a;
#define ps(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr=new type[n];
#define endl "\n"
const int mod = 1000000007;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
const int MAXN = 100005;
const int INF = 1e18;
#define fill(s,x) memset(s,x,sizeof(s));
inline int add(int a, int b) {return ((a % mod + b % mod) % mod);}
inline int sub(int a, int b) {return ((a % mod - b % mod) % mod);}
inline int mult(int a, int b) {return ((a % mod) * (b % mod)) % mod;}
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//         tree_order_statistics_node_update> indexed_set;
// Use __gcd(a,b) for gcd
// find(all(x),key) to get the iterator and its index is obtained by find(all(x),key)-x.begin()
// find_if(iterator_first,iterator_last,unary function) returns first iterator if any element corresponding to unary function exists and if no such element is found it retrurns the last iterator
/*For example:
find_if(all(x),isodd) for x being a vector{10,25,40,55}; *it returns 25*/
/*search(all(v1),all(v2),pred) searches for all the elements of v2 present in v1 based on pred function the iterator correspond
to the first element of sequence if it exists and if not then th elast iterator is obtained.*/
int a[MAXN];
int binsearch(int start, int end, int key) {
    while (start <= end) {
        int mid = start + (end - start) / 2;
        if (a[mid] < key)
            start = mid + 1;
        else if (a[mid] > key)
            end = mid - 1;
        else
            return mid;
    }
    return -1;
}
long long power(long long a, long long b) {
    long long ans = 1;
    while (b > 0) {
        if (b & 1) {ans = (ans * a) % mod;}
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}
int findDuplicate(vector<int>& nums) {
    int ans;
    fr(i, nums.size()) {
        if (nums[abs(nums[i]) - 1] > 0)
            nums[abs(nums[i]) - 1] = -nums[abs(nums[i]) - 1];
        else
            ans = nums[i];
    }
    return abs(ans);
}
bool  in_range(int i, int start, int end) {
    return (i >= start && i <= end);
}
// int power[MAXN];
bool all_character_same(string s) {
    return (s.find_first_not_of(s[0]) == string::npos);
}
int signum(int x) {
    if (x != 0)
        return x > 0 ? 1 : -1;
    return 0;
}
void min_self(int &a, int b) {
    a = min(a, b);
}

void max_self(int &a, int b) {
    a = max(a, b);
}
// Maximum sub-array sum
void solve() {
    int n, W;
    cin >> n >> W;
    vi weight(n), value(n);
    fr(i, n)cin >> weight[i] >> value[i];
    int sum_value = 0;
    fr(i, n)sum_value += value[i];
    vi dp(sum_value + 1, INF);
    dp[0] = 0;
    fr(item, n) {
        for (int value_already = sum_value - value[item]; value_already >= 0; value_already--) {
            min_self(dp[value_already + value[item]], dp[value_already] + weight[item]);
        }
    }
    int answer = 0;
    for (int i = 0; i <= sum_value; i++)
        if (dp[i] <= W)
            max_self(answer, i);

    cout << answer << "\n";
}


int32_t main() {
    fio;

    // indexed_set s;
    // s.insert(2);
    // s.insert(3);
    // s.insert(7);
    // s.insert(9);
    // auto x = s.find_by_order(2);
    // cout << *x << endl;

    // tc {
    //     solve();
    // }

    solve();
    printclock;
    return 0;
}


Measured memory_bytes: 1024