// Slower C++ solution:
#pragma region

#include <algorithm>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <stack>

#include <string>

#include <vector>

typedef long long ll;

#define tr t[root]

#define lson t[root << 1]

#define rson t[root << 1 | 1]

#define rep(i, a, n) for (long long i = a; i <= n; ++i)

#define per(i, a, n) for (long long i = n; i >= a; --i)

#define IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

template <typename T>

void read(T &x) {

    x = 0;

    char ch = getchar();

    ll f = 1;

    while (!isdigit(ch)) {

        if (ch == '-') f *= -1;

        ch = getchar();

    }

    while (isdigit(ch)) {

        x = x * 10 + ch - 48;

        ch = getchar();

    }

    x *= f;

}

using namespace std;

/*

 *                                                     __----~~~~~~~~~~~------___

 *                                    .  .   ~~//====......          __--~ ~~

 *                    -.            \_|//     |||\\  ~~~~~~::::... /~

 *                 ___-==_       _-~o~  \/    |||  \\            _/~~-

 *         __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~

 *     _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /

 *   .~       .~       |   \\ -_    /  /-   /   ||      \   /

 *  /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /

 *  |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\

 *           '         ~-|      /|    |-~\~~       __--~~

 *                       |-~~-_/ |    |   ~\_   _-~            /\

 *                            /  \     \__   \/~                \__

 *                        _--~ _/ | .-~~____--~-/                  ~~==.

 *                       ((->/~   '.|||' -_|    ~~-/ ,              . _||

 *                                  -_     ~\      ~~---l__i__i__i--~~_/

 *                                  _-~-__   ~)  \--______________--~~

 *                                //.-~~~-~_--~- |-------~~~~~~~~

 *                                       //.-~~~--\

 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 */



#pragma endregion

const int maxn = 1e5 + 5;

ll n, W, w[maxn], val[maxn], dp[maxn];

int main() {

    IO;

    cin >> n >> W;

    rep(i, 1, n) cin >> w[i] >> val[i];

    rep(i, 1, 1e5) dp[i] = 0x3f3f3f3f;

    dp[0] = 0;

    rep(i, 1, n) for (int t = 1e5; t >= val[i]; --t) dp[t] = min(dp[t], dp[t - val[i]] + w[i]);

    for (int i = 1e5; i; --i)

        if (dp[i] <= W) {

            cout << i << endl;

            return 0;

        }

}

// Faster C++ solution for the same problem (measured speedup: 2.5203445471303927x):
#include<bits/stdc++.h>

using namespace std;

#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define  ll  long long

const int N=1e5+2;

ll d[102][N];

int main()

{

    ft

    ll t,i,j,n,m,s=0,l,r;

    cin>>n>>m;

    ll w[n+1],v[n+1];

    for(i=1;i<=n;i++)

    {

        cin>>w[i]>>v[i];

        s+=v[i];

    }

    for(i=0;i<=n;i++)

    {

        for(j=0;j<=s;j++)

        {

           d[i][j]=1e15;

        }

    }

    d[0][0]=0;

    for(i=1;i<=n;i++)

    {

        for(j=0;j<=s;j++)

        {

            if(v[i]>j)

            {

                d[i][j]=d[i-1][j];

            }

            else

            {

                d[i][j]=min(d[i-1][j],d[i-1][j-v[i]]+w[i]);

            }

        }

    }

    for(i=s;i>=0;i--)

    {

        if(d[n][i]<=m)

        {

            cout<<i<<"\n";

            break;

        }

    }

    return 0;

}