// Slower C++ solution:
#include <bits/stdc++.h> 



using namespace std;

 

typedef long long ll;

typedef long double ld;

typedef unsigned long long ull;

 

#define nl '\n'

 

#define y1 aza_ibagaliev

 

#define f first

#define s second

	

#define ed end()

#define bg begin()

#define rbg rbegin()

 

#define rv reverse

#define mp make_pair

#define pb push_back

#define ppb pop_back

#define ppf pop_front

 

#define sz size()

#define all(x) x.bg, x.ed

 

#define pll pair < ll, ll >

#define pii pair < int, int >

 

#define sqr(x) ((x) * 1ll * (x))

#define sqrd(x) ((x) * 1.0 * (x))

 

#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

 

#define rnl cout << "----------------------------------------" << nl

 

#define bit __builtin_popcount

 

inline ll bip(ll x, ll n, ll mod){ll res=1;while(n){if(n & 1){res=(res*x)%mod;}x=(x*x)%mod;n>>=1;}return res;}

        	

const int ppr = 257;

const ll INF = 2e18;

const int inf = 2e9;

const int mod = 1e9 + 7;

const int N = 1e5 + 123;

const ld pi = 3.1741592653589793238462643;

 

const int dx[] = {1, 0, -1, 0};

const int dy[] = {0, 1, 0, -1};



int n, W, w[N], v[N];

ll dp[N];



main() {             	

//  freopen(".in", "r", stdin);

//  freopen(".out", "w", stdout);



//	srand(time(NULL));



	cin >> n >> W;



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

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



	for(int i = 1; i <= 1e5; i++)

		dp[i] = INF;

                       

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

		for(int j = 1e5; j >= 0; j--) 

			if(j - v[i] >= 0 && dp[j - v[i]] != INF) {

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

			}



	for(int i = 1e5; i >= 0; i--)

		if(dp[i] <= W) return cout << i, 0;



    return 0;                                        

}

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

#define ll long long

#define pii pair<ll int,ll int>

#define PI 2*acos(0)

//#define mx 100005

#define INF 1e16

using namespace std;

const ll int p=1000000007;

//vector<ll > prime;

//bool mark[mx];

ll int mod(ll int a,ll int b)

{

    ll int m=a%b;

    if(m<0) m=(b<0)?(m-b):(m+b);

    return m;

}

ll maxpow(ll n)

{

    return (n & (~(n-1)));

}

bool isPrime(ll n)

{

    if(n<2) return false;

    if(n==2) return true;

    if(n%2==0) return false;

    for(ll i=3;i*i<=n;i+=2){

        if(n%i==0) return false;

    }

    return true;

}

/*void init()

{

    mark[1]=1;

    int i,j,limit=sqrt(mx*1.0)+2;

    prime.push_back(2);

    for(i=4;i<mx;i+=2) mark[i]=1;

    mark[2]=0;

    for(i=3;i<mx;i+=2){

        if(!mark[i]){

            prime.push_back(i);

            if(i<=limit){

                for(j=i*i;j<mx;j+=2*i){

                    mark[j]=1;

                }

            }

        }

    }

}*/

/*

ll maxdiv(ll n)

{

    ll i,ans=1;

    for(i=0;i<prime.size();i++){

        if(n%prime[i]==0){

            ans=n/prime[i];break;

            //return ans;

        }

    }

    return ans;

}*/

ll lcm(ll a,ll b)

{

    ll ans=a*b;

    return (ans/__gcd(a,b));

}

// ax+by and a>b

ll gcd(ll a,ll b,ll &x,ll &y)

{

    if(b==0){

        x=1;

        y=0;

        return a;

    }

    ll x1,y1;

    ll d=gcd(b,mod(a,b),x1,y1);

    x=y1;

    y=x1-y1*(a/b);

    return d;

}

ll abso(ll a)

{

    if(a>=0) return a;

    return -a;

}

int main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    //ll mx=100005;

    //cout<<mx<<"\n";

    ll i,j,n,x;

    cin>>n>>x;

    ll w[n+1],v[n+1];

    ll V=0;

    for(i=1;i<=n;i++){ cin>>w[i]>>v[i]; V+=v[i]; }

    // dp[i] denotes the minimum total weight of items with total value exactly i;considering each item only once

    ll dp[V+1];

    for(i=1;i<=V;i++) dp[i]=INF;

    dp[0]=0;

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

        // considering the i th item ,as we are going from left to right ,we are considering each item only once

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

            // if this was an increasing loop then this program will make the mistake of using one item more than once

            // every element can be used only once ,therefore the loop is a decreasing loop

            // now we will see if taking the current item will effect any value

            // any value that can be updated can range from v[i] to V , so we will consider all the possibilities

            // before updating dp[j],let's think for a while , we have already updated the list upto (i-1) th item

            // either the j th value will change or it won't

            // we have two options , either we can take the i'th element (1) or not (2)

            // (1) the j th state will remain unchanged

            // (2) or it will be changed by dp[j-v[i]]+w[i]

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

            //cout<<"i="<<i<<" j="<<j<<" "<<dp[j]<<"\n";

        }

    }

    for(i=V;i>=0;i--){

        if(dp[i]<=x){

            cout<<i;

            return 0;

        }

    }

    return 0;

}

//1028C