#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " +
           to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);

    debug_out(T...);
}
#define LOCAL 1
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

typedef vector<int> VI;
typedef pair<char, char> PII;

#define ls (v << 1)
#define rs (ls | 1)
#define tm ((tl + tr) >> 1)

typedef long long LL;
#define si(x) int(x.size())
#define eps 1e-9
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
#define FOR(i, j, k) for (int i = j; i <= k; i++)

#define cls(x) memset(x, 0, sizeof x)
#define inf(x) memset(x, 0x3f, sizeof x)
#define neg(x) memset(x, -1, sizeof x)
#define ninf(x) memset(x, 0xc0, sizeof x)

#define MAXM (int)1e5 + 10
#define MAX 1e4 + 10

#define INF 0x3f3f3f3f
using namespace std;
constexpr int maxn = 200000;

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }

LL A[maxn + 1];
struct Node {
    LL ans, sum, size;
    Node operator+(const Node &node) const {
        Node res;
        res.size = size + node.size;

        if (size & 1)
            res.sum = sum - node.sum;
        else
            res.sum = sum + node.sum;

        if (size & 1)
            res.ans = ans - node.ans - size * node.sum;
        else
            res.ans = ans + node.ans + size * node.sum;

        return res;
    }
} T[maxn << 2];

void build(int v, int tl, int tr) {
    if (tl == tr) {
        T[v].size = 1;
        T[v].ans = T[v].sum = A[tm];
    } else {
        build(ls, tl, tm);
        build(rs, tm + 1, tr);
        T[v] = T[ls] + T[rs];
    }
}

void update(int v, int tl, int tr, int x, int V) {
    if (tl == tr) {
        T[v].ans = T[v].sum = V;
    } else {
        if (x <= tm)
            update(ls, tl, tm, x, V);
        else
            update(rs, tm + 1, tr, x, V);
        T[v] = T[ls] + T[rs];
    }
}

Node query(int v, int tl, int tr, int l, int r) {

    if (l <= tl and tr <= r)
        return T[v];
    if (r <= tm)
        return query(ls, tl, tm, l, r);
    if (l > tm)
        return query(rs, tm + 1, tr, l, r);
    return query(ls, tl, tm, l, r) + query(rs, tm + 1, tr, l, r);
}

void solve() {
    int n, w;
    cin >> n >> w;
    vector<vector<int>> a;

    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        a.push_back({x, y});
    }
    LL dp[100000 + 1] = {};
    inf(dp);
    dp[0] = 0;
    int res = 0;
    for (int i = 1; i <= n; ++i) {

        for (int j = 100000; j >= a[i - 1][1]; --j) {
            dp[j] = min(dp[j], dp[j - a[i - 1][1]] + a[i - 1][0]);
        }
    }
    for (int j = 100000; j; j--) {
        if (dp[j] <= w) {
            res = max(res, j);
        }
    }

    cout << res << endl;
}

int main() {
    // freopen("in.txt", "r", stdin);
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;

    // cin >> t;
    for (int i = 1; i <= t; ++i) {
        // cout << "Case #" << i << ": ";
        solve();
    }

    return 0;
}


Measured memory_bytes: 1024