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

items = [list(map(int, input().split())) for _ in range(N)]

sum_v = sum([item[1] for item in items])

inf = float("inf")

dp = [[inf for _ in range(sum_v+1)] for _ in range(N+1)]





dp[0][0] = 0

for i in range(N):

    for j in range(sum_v+1):

        if j - items[i][1] >= 0:

            dp[i+1][j] = min(dp[i][j], dp[i][j - items[i][1]] + items[i][0])

        else:

            dp[i+1][j] = dp[i][j]

for v in range(sum_v, -1, -1):

    if dp[N][v] <= W:

        print(v)

        exit()



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

items = [list(map(int, input().split())) for _ in range(N)]

sum_v = sum([item[1] for item in items])

inf = float("inf")

dp = [inf for _ in range(sum_v+1)]



dp[0] = 0

for i in range(N):

    for j in range(sum_v, -1, -1):

        if j - items[i][1] >= 0:

            dp[j] = min(dp[j], dp[j - items[i][1]] + items[i][0])



for v in range(sum_v, -1, -1):

    if dp[v] <= W:

        print(v)

        exit()



N, W = list(map(int, input().split()))
items = [list(map(int, input().split())) for _ in range(N)]
sum_v = sum([item[1] for item in items])
inf = float("inf")
dp = [[inf for _ in range(sum_v + 1)] for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
    for j in range(sum_v + 1):
        if j - items[i][1] >= 0:
            dp[i + 1][j] = min(dp[i][j], dp[i][j - items[i][1]] + items[i][0])
        else:
            dp[i + 1][j] = dp[i][j]
for v in range(sum_v, -1, -1):
    if dp[N][v] <= W:
        print(v)
        exit()

N, W = list(map(int, input().split()))
items = [list(map(int, input().split())) for _ in range(N)]
sum_v = sum([item[1] for item in items])
inf = float("inf")
dp = [inf for _ in range(sum_v + 1)]
dp[0] = 0
for i in range(N):
    for j in range(sum_v, -1, -1):
        if j - items[i][1] >= 0:
            dp[j] = min(dp[j], dp[j - items[i][1]] + items[i][0])
for v in range(sum_v, -1, -1):
    if dp[v] <= W:
        print(v)
        exit()

-dp = [[inf for _ in range(sum_v + 1)] for _ in range(N + 1)] -dp[0][0] = 0 +dp = [inf for _ in range(sum_v + 1)] +dp[0] = 0 -    for j in range(sum_v + 1): +    for j in range(sum_v, -1, -1): -            dp[i + 1][j] = min(dp[i][j], dp[i][j - items[i][1]] + items[i][0]) -        else: -            dp[i + 1][j] = dp[i][j] +            dp[j] = min(dp[j], dp[j - items[i][1]] + items[i][0]) -    if dp[N][v] <= W: +    if dp[v] <= W: