// priority_queue is generally max heap to make it min heap use priority_queue<int,vector<int>,greater<int>> pq;"
#include <bits/stdc++.h>
#define int                 long long int
#define double              long double
#define get(a,n)            for(int i=0;i<n;i++){cin>>a[i];}
#define maxm(a)             int maxi=LLONG_MIN;int index;for(int i=0;i<n;i++){if(maxi<a[i]){maxi=a[i];index=i;}}
#define minm(a)             int mini=LLONG_MAX;int index;for(int i=0;i<n;i++){if(mini>a[i]){mini=a[i];index=i;}}
#define db(x)               cout<<"["<<x<<"]"<<endl;
#define vv                  vector
#define endl                "\n"
#define PI                  acos(-1)
#define half(a)             a%2?(a/2+1):a/2
#define array               int a[n];for(int i=0;i<n;i++){cin>>a[i];}
#define pb                push_back
#define all(a)              a.begin(),a.end()
#define mod                 1000000007
#define no                  "NO"
#define yes                 "YES"
using namespace std;
template <typename T>
void printvec(vector<T>& vec){
	for(int i=0;i<vec.size();i++) cout<<vec[i]<<" ";
	cout<<endl;
}
vector<bool> is_prime(100000+1, true);
void seive(int n)
{
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i * i <= n; i++) {
        if (is_prime[i]) {
            for (int j = i * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
}
//this function returns 0 indexing array if the required element
//is less than minimum it returns -1 and greater than max it returns n.
int special_binary(int *a,int n,int x)
{
    int l=0;int r=n-1;int m=0;int f=x;int c=0;
     while(l<=r)
     {
       if(f>a[n-1])
        return n;
       m=(l+r)/2;
       if(a[m]<=f)
       {
           c=m+1;
           l=m+1;
       }
       else
       {
           r=m-1;
       }
     }
     return c-1;
}
void show(int *a,int n)
{
    int size = n;
    for(int i=0;i<size;i++)
    {
            cout<<a[i]<<" ";
    }   
    cout<<endl;
}
int binary_search(int *a,int n,int e)
{
    int f,l,m;f=0;l=n-1;
    while(f<=l)
    {//returns index of that value.
        m=(f+l)/2;
        if(e==a[m])
            return(m);
        else if(e>a[m])
                f=m+1;
            else
                l=m-1;
    }
    return -1;
}
bool cmp(const pair<int,int> &a,const pair<int,int> &b)
{
    return (a.second<b.second);
}
void solve()
{
    int n,weight;
    cin>>n>>weight;
    int w[n+1],v[n+1];int sum=0;
    for(int i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
        sum=sum+v[i];
    }
    int dp[n+1][1000*100]={INT_MAX};
   // cout<<sum<<endl;
    for(int i=0;i<=n;i++)
    {
        for(int val=0;val<=sum+1;val++)
        {
            if(val==0)
            {
                dp[i][val]=0;
            }
            else if(i==0)
            {
                dp[i][val]=INT_MAX;
            }
            else
            {
                int op1=val>=v[i]?dp[i-1][val-v[i]]+w[i]:INT_MAX;
                
                dp[i][val]=min(op1,dp[i-1][val]);
            }
            //cout<<dp[i][val]<<" ";
           
        }
       // cout<<endl;
    }
    //cout<<dp[3][140]<<endl;
        for(int val=sum+1;val>=0;val--)
        {
            for(int i=0;i<=n;i++)
           {
                 if(dp[i][val]<=weight)
                 {
                     cout<<val;
                     return;
                 }
           
           }
        //cout<<endl;
    }
    
    
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(15);
    int t=1;
    //cin>>t;
    //seive(100000);
    while(t--)
    {
        solve();
        
    }
   

  
}

Measured memory_bytes: 82544