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



dp = [[float("inf")]*(10**5+1) for _ in range(n+1)]

dp[0][0] = 0

for i in range(1,n+1):

    weight,value = list(map(int,input().split()))

    for j in range(10**5+1):

        if j < value:

            dp[i][j] = dp[i-1][j]

        else:

            dp[i][j] = min(dp[i-1][j],dp[i-1][j-value]+weight)





ans = 0



for i in range(10**5+1):

    if dp[-1][i] <= w:

        ans = i

print(ans)
import sys

readline = sys.stdin.buffer.readline

def even(n): return 1 if n%2==0 else 0



n,w = list(map(int,readline().split()))

WV = []

for i in range(n):

	WV.append(list(map(int,readline().split())))



dp = [[10**12]*(10**5+1) for _ in range(n+1)]

dp[0][0] = 0



#価値j以上で重さがwを満たすようなものの最大値

for i in range(n):

	for j in range(10**5+1):

		if WV[i][1] - j > 0:

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

		else:

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



ans = 0

for idx,i in enumerate(dp[-1]):

	if i <= w:

		ans = idx



print(ans)
n, w = list(map(int, input().split()))
dp = [[float("inf")] * (10**5 + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(1, n + 1):
    weight, value = list(map(int, input().split()))
    for j in range(10**5 + 1):
        if j < value:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - value] + weight)
ans = 0
for i in range(10**5 + 1):
    if dp[-1][i] <= w:
        ans = i
print(ans)

import sys

readline = sys.stdin.buffer.readline


def even(n):
    return 1 if n % 2 == 0 else 0


n, w = list(map(int, readline().split()))
WV = []
for i in range(n):
    WV.append(list(map(int, readline().split())))
dp = [[10**12] * (10**5 + 1) for _ in range(n + 1)]
dp[0][0] = 0
# 価値j以上で重さがwを満たすようなものの最大値
for i in range(n):
    for j in range(10**5 + 1):
        if WV[i][1] - j > 0:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i][j - WV[i][1]] + WV[i][0])
ans = 0
for idx, i in enumerate(dp[-1]):
    if i <= w:
        ans = idx
print(ans)

-n, w = list(map(int, input().split())) -dp = [[float("inf")] * (10**5 + 1) for _ in range(n + 1)] +import sys + +readline = sys.stdin.buffer.readline + + +def even(n): +    return 1 if n % 2 == 0 else 0 + + +n, w = list(map(int, readline().split())) +WV = [] +for i in range(n): +    WV.append(list(map(int, readline().split()))) +dp = [[10**12] * (10**5 + 1) for _ in range(n + 1)] -for i in range(1, n + 1): -    weight, value = list(map(int, input().split())) +# 価値j以上で重さがwを満たすようなものの最大値 +for i in range(n): -        if j < value: -            dp[i][j] = dp[i - 1][j] +        if WV[i][1] - j > 0: +            dp[i + 1][j] = dp[i][j] -            dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - value] + weight) +            dp[i + 1][j] = min(dp[i][j], dp[i][j - WV[i][1]] + WV[i][0]) -for i in range(10**5 + 1): -    if dp[-1][i] <= w: -        ans = i +for idx, i in enumerate(dp[-1]): +    if i <= w: +        ans = idx