#include<bits/stdc++.h>
// iteration and input/output stream
#define rep(i,a,b) for(int i = int(a);i<=int(b);i++)
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define printarr(x) rep(i,0,x.size()-1) cout<<x[i]<<" "; cout<<endl;
#define all(v) v.begin(),v.end()
 
#define si(x) int x; scanf("%d", &x)
#define sll(x) ll x; scanf("%lld", &x)
#define pi(x) printf("%d", x)
#define pll(x) printf("%lld", x)
#define nl printf("\n")
#define tr(cont,it) \
for(decltype(cont.begin()) it = cont.begin(); it!= cont.end() ; it++)
 
#define endl "\n"
#define tc() int t; cin >> t ; while (t--)
//STL shortcuts
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define F first
#define S second
#define MP make_pair
 
// Error detection
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
using namespace std;
 
typedef long long int ll; // 64 bit integer
typedef unsigned long long int  ull; // 64 bit unsigned integer
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<int,ll> pill;
 
inline void smax(int &x , int y) { x = max(x , y) ; }
inline void smin(int &x , int y) { x = min(x , y) ; }
 
#define MOD 1000000007
#define inf 4000000000000000000LL
#define SYNC std::ios::sync_with_stdio(false);  cin.tie(NULL);

// int ans = 0;//max value such that total w<=W
ll cap =0 ;
vector<vll> dp;
vll w,v;

ll f(int i,int j)
{
    if(dp[i][j]!=-1)
    {
        return dp[i][j];
    }
    else
    {
        if(i==0)
        {
            dp[i][j] = j>0?2e18L:0;
        }
        else
        {
            if(v[i]>j)
            {
                dp[i][j] = f(i-1,j);
            } 
            else
            {
                dp[i][j] = min(f(i-1,j),w[i]+f(i-1,j-v[i]));
                // if(dp[i][j]>0 && dp[i][j]<=cap)
                // {
                //     ans = max(j,ans);
                // }
            }
        }
        // trace4(i,j,v[i],dp[i][j]);
        return dp[i][j];          
    }
}


int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("err.txt","w",stderr);
    #endif
    SYNC
    int n;
    cin>>n>>cap;
    w.resize(n+1);
    v.resize(n+1);
    ll max_v = 0;
    for (int i = 1; i <= n; i++)
    {
        cin>>w[i];
        cin>>v[i];
        max_v+=v[i];
    }
    dp.assign(n+1,vll(max_v+1,-1));
    // trace1("hi");
    // ll temp = f(n,max_v);
    // trace1("110");
    ll ans = 0;
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= max_v; j++)
        {
            // trace3(i,j,dp[i][j]);
            // if(dp[i][j]<=cap)
            // ans = max(ans,j);
            ll cur = f(i,j);
            if(cur<=cap)
            {
                ans = j;
            }
        }
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 83080