// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <cmath>

#include <cstdlib>

#include <cstdio>

#include <cstring>

#include <iomanip>

#include <string>

#include <set>

#include <vector>

#include <queue>

#include <stack>

using namespace std;

#define ms(a, x) memset(a, x, sizeof(a))

#define fore(i, a, n) for (long long i = a; i < n; i++)

#define ford(i, a, n) for (long long i = n - 1; i >= a; i--)

#define si(a) scanf("%d", &a)

#define sii(a, b) scanf("%d%d", &a, &b)

#define debug(a) cout << a << endl

#define endl '\n'

#define pi acos(-1.0)

#define tr t[root]

#define lson t[root << 1]

#define rson t[root << 1 | 1]

#define IO ios::sync_with_stdio(false), cin.tie(0)

const double eps = 1e-8;

inline int sgn(const double &x) { return x < -eps ? -1 : x > eps; }

typedef long long ll;

const int inf = 0x3f3f3f3f;

const int maxn=1000100;

#define maxn0 1e9+7;

//=================================================



ll sum;

ll w[maxn];

ll dp[maxn];

ll v[maxn];



// void init() {

//     for(ll i=0;i<=n;i++){

//         w[i]=0;

//         v[i]=0;

//     }

// }

int main() {

    IO;

    ll n,W;

    cin>>n>>W;

    memset(dp,inf,sizeof(dp));

    dp[0]=0;

    for(int i=1;i<=n;i++){

        cin>>w[i]>>v[i];

        // sum+=v[i];

    }

    for(int i=1;i<=n;i++) {

        for(int j=100000;j>=v[i];j--) {

            dp[j]=min(dp[j],dp[j-v[i]]+w[i]);

        }

    }

    ll ans=-1;

    for(int i=1;i<=100000;++i) {

        if(dp[i]<=W)

            ans=max(ans,1LL*i);

    }

    cout<<ans<<endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 10.255110275606105x):
#include <bits/stdc++.h>

using namespace std;



#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>

void __f(const char* name, Arg1&& arg1) {

  cerr << name << " : " << arg1 << "\n";

}

template <typename Arg1, typename... Args>

void __f(const char* na, Arg1&& arg1, Args&&... args) {

  const char* c = strchr(na + 1, ',');

  cerr.write(na, c - na) << " : " << arg1 << " , ";

  __f(c + 1, args...);

}

#define endl "\n"

#define all(v) v.begin(), v.end()

#define UNIQUE(v) sort(all(v)),v.erase(unique(all(v)),v.end())

typedef long long LL;

typedef pair <int,int> pii;

const double pi = acos(-1.0);

const double eps = 1e-8;

const int mod = 1e9 + 7;

const int inf = 1e9;

const LL INF = 1e18;

const int N = 1e5 + 5;



int main() {

  ios_base::sync_with_stdio(false);

  cin.tie(0); cout.tie(0);

  #ifdef LOCAL

    freopen("input.txt", "r", stdin);

  #endif // LOCAL

  int n, cap;

  cin >> n >> cap;

  vector <int> w (n + 1);

  vector <int> v (n + 1);

  int tot = 0;

  for (int i = 1; i <= n; i++) {

    cin >> w[i] >> v[i];

    tot += v[i];

  }

  vector <vector <int> > dp (n + 5, vector <int> (tot + 5, inf));

  /// dp[i][j] = minimum capacity for which we can make j for upto i'th items

  for (int i = 0; i <= n; i++) dp[i][0] = 0;

  for (int i = 1; i <= n; i++) {

    for (int j = 1; j <= tot; j++) {

      dp[i][j] = dp[i - 1][j];

      if (v[i] <= j) dp[i][j] = min(dp[i][j], dp[i - 1][j - v[i]] + w[i]);

    }

  }

  int mx = 0;

  for (int i = 0; i <= tot; i++) {

    if (dp[n][i] <= cap) mx = i;

  }

  cout << mx << endl;

  return 0;

}