/*
        HELLO WORLD
        -----------
        SHUBHAM
        -----------
        :) CODING
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ff                                         first
#define ss                                         second
#define pb                                         push_back
#define int                                        long long
#define mp                                         make_pair
#define pii                                        pair<int,int>
#define vi                                         vector<int>
#define mii                                        map<int,int>
#define umii                                       unordered_map<int,int>
#define pqb                                        priority_queue<int>
#define pqs                                        priority_queue<int,vi,greater<int>>
#define setbits(x)                                 __builtin_popcountll(x)
#define zerobits(x)                                 __builtin_ctzll(x)
#define mod                                        1000000007
#define inf                                        1e18
#define ps(x,y)                                    fixed<<setprecision(y)<<x
#define mk(arr,n,type)                             type *arr=new type[n]
#define test(t)                                    int t;cin>>t;while(t--)
#define rep(i,n)                                   for(int i=0;i<n;i++)
#define rep1(i,n)                                  for(int i=1;i<=n;i++)
#define fio                                        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SIZE                                       100001
#define all(x)                                     (x).begin(),(x).end()
#define sclk()                                     auto start_time = Clock::now()
#define eclk()                                     auto end_time = Clock::now();  cout << "\nTime Taken : " << chrono::duration_cast<chrono::milliseconds>(end_time    - start_time).count() << " ms"
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef std::chrono::high_resolution_clock Clock;

int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int a,int b) { return b?gcd(b,a%b):a;}

void f_io()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif // ONLINE_JUDGE
}
int dp[101][SIZE],w[101],v[101];
 int n,tot;
int32_t main()
{
    cin>>n>>tot;
    rep(i,n)
    {
        cin>>w[i+1]>>v[i+1];
    }
    int maxval=n*1000;
    for(int i=0;i<=maxval;i++)
        dp[1][i]=INT_MAX;
    dp[1][0]=0;
    dp[1][v[1]]=w[1];
    for(int i=2;i<=n;i++)
    {
        for(int j=0;j<=maxval;j++)
        {
            dp[i][j]=dp[i-1][j];
            if(v[i] > j)
                continue;
            dp[i][j]=min(dp[i][j],w[i]+dp[i-1][j-v[i]]);
        }
    }
    int ans=0;
    for(int i=0;i<=maxval;i++)
    {
        if(dp[n][i]<=tot)
        {
            ans=i;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 78336