#include <bits/stdc++.h>
    #include <unordered_map>
     
    using namespace std;
     
    #define endl '\n'
    #define ll long long
    #define int long long
    const int32_t INFint = 1e9;
    const ll INFll = 1e18;
    const ll INF = 1LL << 60;
    #define MOD 1000000007ll
    #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
     
    #define vi vector < int >
    #define pii pair < int , int >
    #define pb push_back
    #define mp make_pair
    #define ff first
    #define ss second
    #define foreach(it,v) for( __typeof((v).begin())it = (v).begin() ; it != (v).end() ; it++ )
     
    #define deb1(x)                cout<<#x<<": "<<x<<endl
    #define deb2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
    #define deb3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
    #define deb4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
    #define deb5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
    #define deb6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
     
    #define For(i, a, b) for (ll i = a; i < b; i++)
    #define loop(i,a,b) for (int i = a; i < b; i++)
    #define all(v) v.begin(),v.end()
    #define gll(a,n) for(ll i=0;i<n;i++) cin>>a[i];
    #define gint(a,n) for(int i=0;i<n;i++) cin>>a[i];
    #define setZero(a,n) for(int i=0;i<n;i++) a[i]=0;
    #define printArray(a,s,e) for(int i=s;i<e;i++) {cout << a[i] << " ";} cout << endl;
    //---------------------------------------------------------------------------------------------------------------------------------------
    //---------------------------------------------------------------------------------------------------------------------------------------
    //--------------------------------------------------------------------------------------------------------------------------------------- 
    static int dp[1000000001];
     
    int32_t main(){fast;
    	
    	int t;
    	// cin >> t;
    	t = 1;
    	while(t--){
    		int n, w;
    		cin >> n >> w;
     
    		int val[n];
    		int wt[n];
     
    		for(int i=0;i<n;i++) cin >> wt[i] >> val[i];
     
    		// printArray(val, 0, n);
     
    		// int sum = 0;
    		// for(int i=0;i<n;i++) sum += val[i];
     
    		// deb1(sum);
     
    		int dp[n+1][100001];
    		memset(dp, 0, sizeof(dp));
     
    		for(int i=0;i<=n;i++) for(int j=0;j<=100001;j++) dp[i][j] = INF; // initialize everything with unreachable state
     
    		// deb1(dp[0][0]);   // because if price is varying and no items them infinitw weight..
     
    		for(int i=0;i<=n;i++) dp[i][0] = 0; // if price is 0 .. then wight is 0..
     
    		for(int i=1;i<=n;i++){
    			for(int j=1;j<=100001;j++){ // forming a given value with minimum weight which is same as forming a given weight with max value..
    				if(j<val[i-1]) dp[i][j] = dp[i-1][j]; // taking the previous level if the price of the item is greater because we cant choose that item
    				else dp[i][j] = min(dp[i-1][j], dp[i-1][j - val[i-1]] + wt[i-1]);
    				// if(dp[i][j] == 1000000010) break;
    			}
    		}
     
    		// for(int i=0;i<=n;i++){
    		// 	for(int j=0;j<=sum;j++) cout << dp[i][j] << "\t";
    		// 	cout << endl;
    		// }
    		int ans = 0;
    		for(int i=0;i<100001;i++){
    			if(dp[n][i] <= w) ans = i; // traversing the last level and finding the cell with weight <= given weight 
    		}
    		cout << ans << endl;
    	}
    }

Measured memory_bytes: 79232