/***************************************** START OF TEMPLATE *********************************************/

#include<bits/stdc++.h>

using namespace std;

#define  SPEED          ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  newl           cout<<"\n";
#define  f              first
#define  s              second
#define  pb             push_back
#define  mp             make_pair
#define  sym(s)         s="#"+s+"#";
#define  all(x)         (x).begin(),(x).end()
#define  alll(x, n)     x+1, x+n+1
#define  ll             long long
#define  ld             long double
#define  pll            pair<ll,ll>
#define  vll            vector<ll>
#define  vpll           vector<pll>
#define  deb(x...)      _print(x);newl;

void _print() {cout << "";}
void __print(int x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const string &x) {cout << '\"' << x << '\"';}
template<typename T, typename V> void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T> void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? ", " : ""), __print(i); cout << "}";}
template<typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
template<typename T1, typename T2> void mset(T1 &x, T2 val) {memset(x, val, sizeof(x));}
template<typename T1, typename T2> void mset(T1 &a, ll n, T2 v) {foo(i, 0, n)a[i] = v;}
template<typename T1, typename T2> void mset(T1 &a, ll n, ll m , T2 v) {foo(i, 0, n)foo(j, 0, m)a[i][j] = v;}
template<typename T1>void OUT(T1 a[], ll n, ll m) {foo(i, 1, n) {foo(j, 1, m) {cout << a[i][j] << " ";} newl;}}
void OUT(ll a[], ll n) {foo(i, 1, n) cout << a[i] << " "; newl;}
void OUT(pll a[], ll n) {foo(i, 1, n) __print(a[i]); newl;}

const ld   PI    =  3.14159265358979323846;
const ll   MOD   =  1e+9 + 7;
const ll   INF   =  1e16;
const int  INFi  =  INT_MAX;
const ll   N     =  1e+2 + 8;

vll adj[N]; ll vis[N];
ll dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};

ll test_cases = 1; randomINIT;

/*********************************************************************************************************/
/***************************************** VARIABLE DECLARATIONS *****************************************/
ll n, ww[N], vv[N], dp[N][100008];
ll s, sv, tv = 0;
/***************************************** FUNCTION IMPLEMENTATIONS **************************************/
ll solve(ll i, ll v) {
    if (v <= 0) return 0;
    if (i == n + 1) return INF;
    if (dp[i][v] != -1) return dp[i][v];
    ll ans = min(solve(i + 1, v - vv[i]) + ww[i], solve(i + 1, v));
    return dp[i][v] = ans;
}

ll solver() {
    mset(dp , -1);
    frr(i, tv, 0) {
        if (solve(1, i) <= s) {
            return i;
        }
    }
    return -1;

}
/***************************************** START OF MAIN FUNCTION ****************************************/
void MAIN(ll tc) {
    cin >> n >> s;
    foo(i, 1, n) {
        cin >> ww[i] >> vv[i];
        tv += vv[i];
    }
    cout << solver();
}

int main() {
    SPEED;

    //cin>>test_cases;
    foo(i, 1, test_cases) {
        MAIN(i);
    }
}


Measured memory_bytes: 84608