//  __/\\\\____________/\\\\______/\\\\\\\\\______/\\\________/\\\___/\\\\\\\\/\\____/\\\\\\\\\\_|
//   _\/\\\\\\________/\\\\\\____/\\\\\\\\\\\\\___\/\\\________/\\\__\/\\\____\/\\\__\////\\\///__|
//    _\/\\\//\\\____/\\\//\\\___/\\\/////////\\\__\/\\\________/\\\__\/\\\____\/\\\\____\/\\\_____|
//     _\/\\\\///\\\/\\\/_\/\\\__\/\\\_______\/\\\__\/\\\\\\\\\\\\\\\__\/\\\____\/\\\\____\/\\\_____|
//      _\/\\\__\///\\\/___\/\\\__\/\\\\\\\\\\\\\\\__\/\\\/////////\\\__\/\\\____\/\\\\____\/\\\_____|
//       _\/\\\____\///_____\/\\\__\/\\\/////////\\\__\/\\\_______\/\\\__\/\\\____\/\\\_____\/\\\_____|
//        _\/\\\_____________\/\\\__\/\\\_______\/\\\__\/\\\_______\/\\\__\/\\\___/\\\\______\/\\\_____|
//         _\/\\\_____________\/\\\__\/\\\_______\/\\\__\/\\\_______\/\\\__\/\\\\\\/\\_____/\\\\\\\\\\__|
//          _\///______________\///___\///________\///___\///________\///___\/////////_____\//////////___|
#include<bits/stdc++.h>
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef vector< int > vi;
typedef vector< char > vc;
typedef vector< string > vs;
typedef vector< long long > vl;
#define hurry ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define setp setprecision
#define popp pop_back()
#define pb push_back
#define mp make_pair
#define beg begin()
#define end end()
#define sc second
#define sz size()
#define fr first
#define endl '\n'
//=======================================================================================================================
//GLOBAL
ll dp[109][100009];
int v[1000],w[1000];
//=======================================================================================================================
//FUNCTIONS
//=======================================================================================================================
int main()
{
    int n,W;
    cin>>n>>W;
    for(int i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
    }
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=100002;j++)
        {
            dp[i][j]=100000000002;
        }
    }
    dp[0][0]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=100002;j++)
        {
            if(j>=v[i])
            {
                dp[i][j]=min((dp[i-1][j-v[i]]+w[i]),dp[i-1][j]);
            }
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    for(int i=100002;i>=0;i--)
    {
        if(dp[n][i]<=W)
        {
            cout<<i;
            return 0;
        }
    }
}
//=======================================================================================================================
/*
    int n,m;
    cin>>n>>m;
    int v[n],w[n];
    for(int i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=100002;j++)
        {
            dp[i][j]=100000000002;
        }
    }
    dp[1][v[1]]=w[1];
    for(int i=2;i<=n;i++)
    {
        for(int j=2;j<=100002;j++)
        {
            if(j>v[i] and j!=v[1])
            {
                dp[i][j]=min((dp[i-1][j-v[i]]+w[i]),dp[i-1][j]);
            }
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    for(int i=100002;i>=0;i--)
    {
        if(dp[n][i]!=100000000002 and dp[n][i]<=m)
        {
            cout<<i;
            return 0;
        }
    }

while(cin>>k>>n)
    {
        if(k==0 and n==0)
            return 0;
        else
        {
            k=min(k,15);
            if(k==1)
                cout<<n<<'\n';
            for(int i=1;i<=k;i++)
                dp[i][1]=1;
            for(int i=1;i<=100;i++)
            {
                dp[1][i]=i;
                dp[2][i]=(i*i)/2;
            }
            for(int i=2;i<k;i++)
            {
                for(int j=2;j<=100;j++)
                {
                    dp[i][j]=dp[i-1][j-1]+dp[i][j-1];
                }
            }
            for(int i=1;i<=100;i++)
            {
                if(dp[k][i]>=n)
                {
                    cout<<i<<'\n';
                    break;
                }
            }
        }
    }*/


Measured memory_bytes: 80128