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

dp=[999999999999999]*(100001)

dp[0]=0

for i in range(n):

	wt,val=list(map(int,input().split()))

	for j in range(100000,val-1,-1):

		dp[j]=min(dp[j],dp[j-val]+wt)

for i in range(100000,-1,-1):

	if dp[i]<=w:

		print(i)

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

l=(n*1000)+1

dp=[9999999999]*(l)

dp[0]=0

for i in range(n):

	wt,val=list(map(int,input().split()))

	for j in range(l-1,val-1,-1):

		dp[j]=min(dp[j],dp[j-val]+wt)

for i in range(l-1,-1,-1):

	if dp[i]<=w:

		print(i)

		exit()
n, w = list(map(int, input().split()))
dp = [999999999999999] * (100001)
dp[0] = 0
for i in range(n):
    wt, val = list(map(int, input().split()))
    for j in range(100000, val - 1, -1):
        dp[j] = min(dp[j], dp[j - val] + wt)
for i in range(100000, -1, -1):
    if dp[i] <= w:
        print(i)
        exit()

n, w = list(map(int, input().split()))
l = (n * 1000) + 1
dp = [9999999999] * (l)
dp[0] = 0
for i in range(n):
    wt, val = list(map(int, input().split()))
    for j in range(l - 1, val - 1, -1):
        dp[j] = min(dp[j], dp[j - val] + wt)
for i in range(l - 1, -1, -1):
    if dp[i] <= w:
        print(i)
        exit()

-dp = [999999999999999] * (100001) +l = (n * 1000) + 1 +dp = [9999999999] * (l) -    for j in range(100000, val - 1, -1): +    for j in range(l - 1, val - 1, -1): -for i in range(100000, -1, -1): +for i in range(l - 1, -1, -1):