#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin>>n;
  int w;
  cin>>w;
  vector<int> a(n),b(n);
  for (int i=0;i<n;i++) {
    cin>>a[i];
    cin>>b[i];
  }
  vector<long int> dp(100001,1e10);
  dp[0]=0;
  for (int i=0;i<n;i++) {
    for (int j=100000;j>=b[i];j--) dp[j] = min(dp[j],dp[j-b[i]]+a[i]); 
  }
  int soln=0;
  for (int i=1;i<=100000;i++) {
    if (dp[i]<=w*1l) soln = i;
  }
  cout<<soln;
  return 0;
}
  