import sys

sys.setrecursionlimit(2147483647)

INF=float("inf")

MOD=10**9+7

input=lambda :sys.stdin.readline().rstrip()

def resolve():

    n,W=list(map(int,input().split()))

    WV=[tuple(map(int,input().split())) for _ in range(n)]



    V=100000

    dp=[INF]*(V+1)

    dp[0]=0



    for w,v in WV:

        for x in range(V,-1,-1):

            if(x+v<=V):

                dp[x+v]=min(dp[x+v],dp[x]+w)



    for x in range(V,-1,-1):

        if(dp[x]<=W):

            print(x)

            return

resolve()
import sys

INF = 1 << 60

MOD = 10**9 + 7 # 998244353

sys.setrecursionlimit(2147483647)

input = lambda:sys.stdin.readline().rstrip()

def resolve():

    n, W = list(map(int, input().split()))

    dp = [INF] * (n * 1001 + 1)

    dp[0] = 0

    for _ in range(n):

        w, v = list(map(int, input().split()))

        for v0 in range(n * 1001, -1, -1):

            if dp[v0] == INF:

                continue

            if v + v0 <= n * 1001:

                dp[v + v0] = min(dp[v + v0], dp[v0] + w)

    for v in range(n * 1001, -1, -1):

        if dp[v] <= W:

            print(v)

            return

resolve()
import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()


def resolve():
    n, W = list(map(int, input().split()))
    WV = [tuple(map(int, input().split())) for _ in range(n)]
    V = 100000
    dp = [INF] * (V + 1)
    dp[0] = 0
    for w, v in WV:
        for x in range(V, -1, -1):
            if x + v <= V:
                dp[x + v] = min(dp[x + v], dp[x] + w)
    for x in range(V, -1, -1):
        if dp[x] <= W:
            print(x)
            return


resolve()

import sys

INF = 1 << 60
MOD = 10**9 + 7  # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()


def resolve():
    n, W = list(map(int, input().split()))
    dp = [INF] * (n * 1001 + 1)
    dp[0] = 0
    for _ in range(n):
        w, v = list(map(int, input().split()))
        for v0 in range(n * 1001, -1, -1):
            if dp[v0] == INF:
                continue
            if v + v0 <= n * 1001:
                dp[v + v0] = min(dp[v + v0], dp[v0] + w)
    for v in range(n * 1001, -1, -1):
        if dp[v] <= W:
            print(v)
            return


resolve()

+INF = 1 << 60 +MOD = 10**9 + 7  # 998244353 -INF = float("inf") -MOD = 10**9 + 7 -    WV = [tuple(map(int, input().split())) for _ in range(n)] -    V = 100000 -    dp = [INF] * (V + 1) +    dp = [INF] * (n * 1001 + 1) -    for w, v in WV: -        for x in range(V, -1, -1): -            if x + v <= V: -                dp[x + v] = min(dp[x + v], dp[x] + w) -    for x in range(V, -1, -1): -        if dp[x] <= W: -            print(x) +    for _ in range(n): +        w, v = list(map(int, input().split())) +        for v0 in range(n * 1001, -1, -1): +            if dp[v0] == INF: +                continue +            if v + v0 <= n * 1001: +                dp[v + v0] = min(dp[v + v0], dp[v0] + w) +    for v in range(n * 1001, -1, -1): +        if dp[v] <= W: +            print(v)