import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
import std.typecons, std.regex;

void main() {
    int n = read.to!int;
    long W = read.to!long;
    auto w = new long[](n);
    auto v = new int[](n);
    foreach(i; 0..n) {
        w[i] = read.to!long;
        v[i] = read.to!int;
    }
    auto dp = new long[][](n+1, v.sum+1);
    foreach(i; 0..dp.length) fill(dp[i], 1L << 60);
    dp[0][0] = 0;
    foreach(i; 0..n) {
        foreach(j; 0..v.sum+1) {
            chmin(dp[i+1][j], dp[i][j]);
            if (j+v[i] < dp[0].length) chmin(dp[i+1][j+v[i]], dp[i][j] + w[i]);
        }
    }
    int ret = 0;
    foreach(i; 0..v.sum+1) {
        if (dp[n][i] <= W) {
            ret = i;
        }
    }
    writeln(ret);
}

void chmin(T)(ref T a, T b) {
    if (a > b) a = b;
}

string read() {
    static string[] ss;
    while (!ss.length) ss = readln.chomp.split;
    auto res = ss[0];
    ss.popFront;
    return res;
}
