import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
alias Goods = Tuple!(long, "w", long, "v");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

auto dp = new long[][](110, 100_100);
void main()
{
    long N, W;
    scan(N, W);
    auto goods = new Goods[](N);
    foreach (ref e; dp)
        e[] = INF;

    foreach (i; iota(N))
    {
        long w, v;
        scan(w, v);
        goods[i] = Goods(w, v);
    }
    foreach (i; iota(N))
    {
        foreach (j; iota(100_100))
        {
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j]);
            if (j == 0)
                if (goods[i].w <= W)
                    dp[i + 1][j + goods[i].v] = goods[i].w;
            if (dp[i][j] != INF)
                if (dp[i][j] + goods[i].w <= W)
                    dp[i + 1][j + goods[i].v] = dp[i][j] + goods[i].w;
        }
        // dp[i + 1].take(20).writeln();
    }
    dp[N].maxidx.writeln();
}

auto maxidx(T)(T a)
{
    long ret;
    foreach (i, e; a)
        if (e != INF)
            ret = i;

    return ret;
}
