/* Pain. Anger. Hatred. Ego.
                                                      Survive. Live. Win. Conquer. */

                                                          /*#Quota_Reform .
                                                        #We_Want_Safe_Roads .
                                                          #We_Want_Justice .
                                                            #Support_Us .
                                                            #Bangladesh .
                                                          */


#include<bits/stdc++.h>
using namespace std;
typedef long long LL ;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define ook order_of_key
#define fbk find_by_order
#define bug printf("Massacre.\n");
#define pf printf
#define sf scanf
#define pb push_back
#define r0 return 0
#define ff first
#define ss second
#define mp make_pair
#define set0(a) memset ((a), 0 , sizeof(a))
#define set1(a) memset((a),-1,sizeof (a))
#define si(a) scanf("%d" , &a)
#define sl(a) scanf("%lld" , &a)
#define sii(a,b) scanf("%d %d" , &a , &b)
#define siii(a,b,c) scanf("%d %d %d" , &a , &b, &c)
#define sll(a,b) scanf("%lld %lld" , &a , &b)
#define slll(a,b,c) scanf("%lld %lld %lld" , &a , &b, &c)
#define pll pair <LL, LL>
#define pii pair <int, int>
#define vi  vector <int>
#define vl  vector <LL>
#define all(x) (x).begin(), (x).end()
#define vii vector <pair <int, int> >
#define vll vector < pair <LL, LL> >
#define mod 1000000007

//using namespace __gnu_pbds;
//typedef tree < int, null_type ,less<int>,rb_tree_tag,tree_order_statistics_node_update > ordered_set;

void func(void)
{
        freopen("input.c","r",stdin);
        freopen("output.c","w",stdout);
}

void print(vector <LL> &v){
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++){
        pf("%lld ", v[i]);
    }
    pf("\n");
}

void print(vector <pll> &v){
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++){
        pf("%lld %lld\n", v[i].ff, v[i].ss);
    }
}

void print(double d){
    cout << fixed << setprecision(10) << d << endl;
}

void print(string s, double d){
    cout << s << " ";
    cout << fixed << setprecision(10) << d << endl;
}

const int N = 1e5 + 10;
LL dp[102][N];
LL given, n;
LL val[102], w[102];
LL calc(LL i, LL j){
    //if(j > given)return 1e18;
    if(i == n){
        if(j >= given)return 0;
        return 1e18;
    }
    LL &ret = dp[i][j];
    if(ret != -1)return ret;
    LL x = min(calc(i + 1, j), w[i] + calc(i + 1, j + val[i]));
    return ret = min(x, (long long) 1e18);
}


LL bs(LL W){
    LL low = 0, mid;
    LL high = N - 2;
    LL res = 0;
    while(low <= high){
        mid = (low + high)/2;
        given = mid;
        set1(dp);
       // cout << mid << " ... " << given << endl;
        if(calc(0, 0) <= W){
            low = mid + 1;
            res = mid;
        }
        else high = mid - 1;
    }
    return res;
}

int main(){
//    ios_base::sync_with_stdio(0); cin.tie(0);
    LL q, i,j = 0, temp, t, k, ans = 0, sum = 0, x, y, z, cnt = 0, m, fg = 0, mx = 0, mx1 = 0, mn = 8000000000000000000, mn1 = 8000000000000000000;
    LL W;
    sll(n, W);
    for(int i = 0; i < n; i++){
        sll(w[i], val[i]);
    }
    cout << bs(W) << endl;
}


Measured memory_bytes: 80000