# coding: utf-8

# Your code here!

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



jwels=[]



for _ in range(N):

    jwels.append(list(map(int,input().split())))



dp=[10**10]*(10**5+1)

dp[0]=0



for w,v in jwels:

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

        if dp[i]!=10**10 and i+v<=10**5:

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



#print(dp[:100])



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

    if dp[i]<=W:

        print(i)

        break





# coding: utf-8

# Your code here!

#D流用したので文字滅茶苦茶

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



dp=[10**9+1]*(10**5+1)

dp[0]=0





for _ in range(N):

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

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

        if dp[i]!=-10**9+1 and i+v<=10**5:

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





ans=0

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

    if dp[i]<=W:

        ans=i



print(ans)
# coding: utf-8
# Your code here!
N, W = list(map(int, input().split()))
jwels = []
for _ in range(N):
    jwels.append(list(map(int, input().split())))
dp = [10**10] * (10**5 + 1)
dp[0] = 0
for w, v in jwels:
    for i in range(10**5 + 1)[::-1]:
        if dp[i] != 10**10 and i + v <= 10**5:
            dp[i + v] = min(dp[i] + w, dp[i + v])
# print(dp[:100])
for i in range(10**5 + 1)[::-1]:
    if dp[i] <= W:
        print(i)
        break

# coding: utf-8
# Your code here!
# D流用したので文字滅茶苦茶
N, W = list(map(int, input().split()))
dp = [10**9 + 1] * (10**5 + 1)
dp[0] = 0
for _ in range(N):
    w, v = list(map(int, input().split()))
    for i in range(10**5 + 1)[::-1]:
        if dp[i] != -(10**9) + 1 and i + v <= 10**5:
            dp[i + v] = min(dp[i] + w, dp[i + v])
ans = 0
for i in range(10**5 + 1):
    if dp[i] <= W:
        ans = i
print(ans)

+# D流用したので文字滅茶苦茶 -jwels = [] +dp = [10**9 + 1] * (10**5 + 1) +dp[0] = 0 -    jwels.append(list(map(int, input().split()))) -dp = [10**10] * (10**5 + 1) -dp[0] = 0 -for w, v in jwels: +    w, v = list(map(int, input().split())) -        if dp[i] != 10**10 and i + v <= 10**5: +        if dp[i] != -(10**9) + 1 and i + v <= 10**5: -# print(dp[:100]) -for i in range(10**5 + 1)[::-1]: +ans = 0 +for i in range(10**5 + 1): -        print(i) -        break +        ans = i +print(ans)