//***********************************************************************************************************//
//    TOPIC :
//***********************************************************************************************************//
#include <iostream>
using namespace std;
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define ll long long int
#define ull unsigned long long int
#define INF 99999999
ll mod = 1e9 + 7;

// int mod = 1e9 + 7;
#define fr(a, b, c) for (int a = b; a < c; a++)
#define fre(a, b, c) for (int a = b; a <= c; a++)

class Timer
{
public:
    clock_t starting;
    Timer()
    {
        cout << "**..** Timer clock init **..**" << endl;
    }
    void start()
    {
        starting = clock();
    }
    void end()
    {
        double duration = (clock() - this->starting) / (double)CLOCKS_PER_SEC;
        cout << "**..** Time taken is " << duration << endl;
    }
};

void the_martian()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif
}

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll powm(ll a, ull b)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}

ll dp[105][100005];

ll inf = 1e18;

void solve(int val, ll w, int w_arr[], int v_arr[], int size)
{

    for (int i = 0; i <= size; i++)
    {
        for (int j = 0; j <= val; j++)
        {
            if (i == 0)
                dp[i][j] = inf;
            else
            {
                if (j == v_arr[i - 1])
                    dp[i][j] = min(dp[i - 1][j], (ll)w_arr[i - 1]);
                else if (j < v_arr[i - 1])
                    dp[i][j] = dp[i - 1][j];
                else
                {
                    if (dp[i - 1][j - v_arr[i - 1]] != inf)
                        dp[i][j] = min(dp[i - 1][j], w_arr[i - 1] + dp[i - 1][j - v_arr[i - 1]]);
                    else
                        dp[i][j] = dp[i - 1][j];
                }
            }
        }
    }

    // cout << val << " " << dp[size][val] << endl;
    // for (int i = 0; i <= size; i++)
    // {
    //     for (int j = 0; j <= val; j++)
    //     {
    //         if (dp[i][j] == inf)
    //             cout << "I"
    //                  << " ";
    //         else
    //             cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    // if (dp[size][val] != 0 && dp[size][val] != -1 && dp[size][val] <= w)
    //     return true;
    // else
    //     return false;
}
int main()
{
    
    int n, k;
    cin >> n >> k;
    int w_arr[n];
    int v_arr[n];

    int max_sum = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> w_arr[i];
        cin >> v_arr[i];
        max_sum += v_arr[i];
    }
    max_sum++;

    int h = max_sum;

    // while (l < h)
    // {
    //     int m = (l + h) / 2;
    //     if (isPossible(m, k, w_arr, v_arr, n))
    //     {
    //         ans = m;
    //         l = m + 1;
    //     }
    //     else
    //     {
    //         h = m;
    //     }
    // }

    solve(h, k, w_arr, v_arr, n);

    int ans = -1;
    for (int j = 1; j <= n; j++)
    {
        // cout << dp[j][17] << endl;
        for (int i = 0; i <= h; i++)
        {
            if (dp[j][i] <= k)
            {

                ans = max(ans, i);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 80256