import std.stdio, std.array, std.conv, std.typecons, std.algorithm;

immutable INF = 1<<30;

long impl(long n, long v, const ref long[] ws, const ref long[] vs, ref long[][] dp) {
    if(dp[n][v] == INF) {
        const auto yes = {
            const auto prev_v = v-vs[n-1];
            return prev_v >= 0 ? impl(n-1, prev_v, ws, vs, dp) + ws[n-1] : INF;
        }();
        const auto no = impl(n-1, v, ws, vs, dp);
        dp[n][v] = min(yes, no, dp[n][v]);
    }
    return dp[n][v];
}

long solve(long n, long w, const ref long[] ws, const ref long[] vs) {
    const long avg = (vs.sum + vs.count - 1) / vs.count;
    auto vmax = avg*n;

    auto dp = new long[][](n+1, vmax+1);
    foreach(ref v ; dp[]) { v[] = INF;} // clear all
    foreach(ref v ; dp[0]) { v = INF-1;} // set dp[0][x]
    dp[0][0] = 0;

    for(long i = vmax; i >= 0; i--) {
        auto ret_w = impl(n, i, ws, vs, dp);
        if (ret_w <= w) return i;
    }

    return -1; // unreachable
}

void main() {
    immutable i1 = readln.split.to!(long[]);
    immutable n = i1[0], w = i1[1];
    auto ws = new long[n];
    auto vs = new long[n];

    for(auto i = 0; i < n; i++) {
        auto input = readln.split.to!(long[]);
        ws[i] = input[0];
        vs[i] = input[1];
    }

    writeln(solve(n, w, ws, vs));
}
