import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 10L^^15;

void main() {
    int n, w;
    scan(n, w);

    auto ws = new int[](n);
    auto v = new int[](n);
    int vs;

    foreach (i ; 0 .. n) {
        scan(ws[i], v[i]);
        vs += v[i];
    }

    auto dp = new long[](vs + 1);
    dp[] = inf;
    dp[0] = 0;

    foreach (i ; 0 .. n) {
        foreach_reverse (j ; 0 .. vs - v[i] + 1) {
            dp[j + v[i]] = min(dp[j + v[i]], dp[j] + ws[i]);
        }
    }

    foreach_reverse (i ; 0 .. vs + 1) {
        if (dp[i] <= w) {
            writeln(i);
            return;
        }
    }
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}