// #include<bits/stdc++.h>
// using namespace std;
 
// typedef vector <int> vi;
// typedef pair< int ,int > pii;
// #define all(v) v.begin(),v.end()
// #define PB push_back
// #define T(val) while(val--)
// #define FIN for(i=0;i<n;i++)
// #define FIS for(i=0;i<s.length();i++)
// #define AIN for(i=0;i<n;i++){cin>>a[i];}
// #define F(i,k,n) for(i=k;i<n;i++)
// #define FG(i,k,n,x) for(i=k;i<n;i+=x)
// #define YES cout<<"YES\n"; 
// #define NO cout<<"NO\n"; 
// #define ll long long
// #define MOD 1000000007
// #define deb(x) cout << #x << "=" << x << endl;
// #define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
// #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// //sort(arr, arr+n, greater<int>()); For sorting in reverse order

// int solve(){
//   int i,n,m;
//   cin>>n>>m;
//   vector < int > DG[n],UG[n];
//   int x,y,z;
//   F(i,0,m){
//     cin>>x>>y>>z;
//     if(x==0){
//       UG[x].PB(y);
//       UG[y].PB(x);
//     }
//     if(x==1){
//       DG[x].PB(y);
//     }
//   }
//   iscyclic()
//   return 0;
// }
// int main(){
// fast
//   int t;
//   cin>>t;
//   T(t){
//     solve();
//   }
//   return 0;
// }

/*
#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define all(v) v.begin(),v.end()
#define PB push_back
#define T(val) while(val--)
#define FIN for(i=0;i<n;i++)
#define FIS for(i=0;i<s.length();i++)
#define AIN for(i=0;i<n;i++){cin>>a[i];}
#define F(i,k,n) for(i=k;i<n;i++)
#define FG(i,k,n,x) for(i=k;i<n;i+=x)
#define YES cout<<"YES\n"; 
#define NO cout<<"NO\n"; 
#define ll long long
#define MOD 1000000007
#define deb(x) cout << #x << "=" << x << endl;
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//sort(arr, arr+n, greater<int>()); For sorting in reverse order 


ll a[100005];

int solve(){
  int n,i;
  cin>>n;
  ll temp=0,pre=0;
  //cout<<log2(power(10,18))<<"\n";
  set < ll > S;
  FIN{
    cin>>a[i];
    S.insert(a[i]);
  }
  if(S.size()<n){
    NO
    return 0;
  }
  if(n>59){
    NO
    return 0;
  }
  FIN{
    temp=temp|a[i];
    if(temp==pre){
      NO;
      return 0;
    }
    pre=temp;
  }
  YES
  return 0;
}
int main(){
fast
  int t;
  cin>>t; 
  T(t){
    solve();
  }
  return 0;
}*/
/*
#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define all(v) v.begin(),v.end()
#define PB push_back
#define T(val) while(val--)
#define FIN for(i=0;i<n;i++)
#define FIS for(i=0;i<s.length();i++)
#define AIN for(i=0;i<n;i++){cin>>a[i];}
#define F(i,k,n) for(i=k;i<n;i++)
#define FG(i,k,n,x) for(i=k;i<n;i+=x)
#define YES cout<<"YES\n"; 
#define NO cout<<"NO\n"; 
#define ll long long
#define MOD 1000000007
#define deb(x) cout << #x << "=" << x << endl;
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//sort(arr, arr+n, greater<int>()); For sorting in reverse order 
int a[5000];
int solve(){
  int n,i;
  cin>>n;
  for(i=0;i<n*2;i++){
    cin>>a[i];
  }
  vector < int > v1,v2;
  int max=0;
  bool flag= true;
  int r=0;
  for(i=1;i<n*2;i++){
    
    if(a[i]>a[i+1]&&a[i]>a[i-1]){
      max= a[i];
      deb(a[i])
      if (flag){
        for(int j=r;j<i;j++){
          v1.PB(a[j]);
        }
      }
      else{
        for(int j=r;j<i;j++){
          v2.PB(a[j]);
        }
      }
      r=i;
      flag=!flag;
    }
    if(i==2*n-1){
      // flag=!flag;
      if (flag){
        for(int j=r;j<2*n;j++){
          v1.PB(a[j]);
        }
      }
      else{
        for(int j=r;j<2*n;j++){
          v2.PB(a[j]);
        }
      }
      continue;
    }
  }
  for(i=0;i<v1.size();i++){
    cout<<v1[i]<<" ";
  }
  cout<<"\n";
  for(i=0;i<v2.size();i++){
    cout<<v2[i]<<" ";
  }
  cout<<"\n";
  if(v1.size()==v2.size()){
    YES
  }
  else{
    NO
  }
  return 0;
}
int main(){
fast
  int t;
  cin>>t; 
  T(t){
    solve();
  }
  return 0;
}*/
/*
#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define all(v) v.begin(),v.end()
#define PB push_back
#define T(val) while(val--)
#define FIN for(i=0;i<n;i++)
#define FIS for(i=0;i<s.length();i++)
#define AIN for(i=0;i<n;i++){cin>>a[i];}
#define F(i,k,n) for(i=k;i<n;i++)
#define FG(i,k,n,x) for(i=k;i<n;i+=x)
#define YES cout<<"YES\n"; 
#define NO cout<<"NO\n"; 
#define ll long long
#define MOD 1000000007
#define deb(x) cout << #x << "=" << x << endl;
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//sort(arr, arr+n, greater<int>()); For sorting in reverse order 
ll dp[102][1000000002];
ll knapsack(ll  W,ll w[],ll v[],ll n){
  if(W==0||n==0){
    return 0;
  }
  if(dp[n][W]!=-1){
    return dp[n][W];
  }
  if(w[n-1]>W)
  return dp[n][W]=knapsack( W,w,v,n-1);

  else{
    return dp[n][W]=max(knapsack( W,w,v,n-1),v[n-1]+knapsack( W-w[n-1],w,v,n-1));
  }
}

int solve(){
  ll N,W;
  cin>>N>>W;
  memset(dp,-1,sizeof(dp));
  // deb2(N,W)
  ll w[N],v[N];
  for(int i=0;i<N;i++){
    cin>>w[i]>>v[i];
  }
  cout<<knapsack(W,w,v,N)<<"\n";
  return 0;
}
int main(){
fast
  int t=1;
  // cin>>t; 
  T(t){
    solve();
  }
  return 0;
}*/

#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define all(v) v.begin(),v.end()
#define PB push_back
#define T(val) while(val--)
#define FIN for(i=0;i<n;i++)
#define FIS for(i=0;i<s.length();i++)
#define AIN for(i=0;i<n;i++){cin>>a[i];}
#define F(i,k,n) for(i=k;i<n;i++)
#define FG(i,k,n,x) for(i=k;i<n;i+=x)
#define YES cout<<"YES\n"; 
#define NO cout<<"NO\n"; 
#define ll long long
#define MOD 1000000007
#define deb(x) cout << #x << "=" << x << endl;
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//sort(arr, arr+n, greater<int>()); For sorting in reverse order 
ll dp[101][100001];

int solve(){
  ll N,W;
  cin>>N>>W;
  ll w[N],v[N];
  ll i,j;
  for(i=0;i<N;i++){
    cin>>w[i]>>v[i];
  }
  
  for(i=0;i<=N;i++){
    for(ll j=0;j<=100000;j++)
      dp[i][j]=1e18;
  }
  dp[1][0]=0;
  dp[1][v[0]]=w[0];
  for(i=2;i<=N;i++){
    dp[i][0]=0;
    for(j=1;j<=100000;j++){
      if(w[i-1]>W){
        dp[i][j]=dp[i-1][j];
      }
      else
        dp[i][j]=min(dp[i-1][j],w[i-1] + dp[i-1][j-v[i-1]]);
    }
  }
  
  for(i=100000;i>=0;i--){
    // cout<<i<<" "<<dp[N][i]<<"\n";
    if(dp[N][i]<=W){
      cout<<i<<"\n";
      return 0;
    }
  }
  return 0;
}
int main(){
fast
  int t=1;
  // cin>>t; 
  T(t){
    solve();
  }
  return 0;
}

Measured memory_bytes: 82556