# coding: utf-8

# Your code here!

# coding: utf-8

# Your code here!

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



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

l[0]=0

dp=l[:]



#indexが価値　itemが重さ

for i in range(N):

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

    for index,item in enumerate(l):

        if item!=10**10 and item+w<=W:

            dp[index+v]=min(l[index+v],item+w)

    l=dp[:]



ans=0

for index, item in enumerate(l):

    if item!=10**10:

        ans=index

    else:

        continue

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!
# coding: utf-8
# Your code here!
N, W = list(map(int, input().split()))
l = [10**10] * (10**5 + 1)
l[0] = 0
dp = l[:]
# indexが価値　itemが重さ
for i in range(N):
    w, v = list(map(int, input().split()))
    for index, item in enumerate(l):
        if item != 10**10 and item + w <= W:
            dp[index + v] = min(l[index + v], item + w)
    l = dp[:]
ans = 0
for index, item in enumerate(l):
    if item != 10**10:
        ans = index
    else:
        continue
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! -l = [10**10] * (10**5 + 1) -l[0] = 0 -dp = l[:] -# indexが価値　itemが重さ -for i in range(N): -    w, v = list(map(int, input().split())) -    for index, item in enumerate(l): -        if item != 10**10 and item + w <= W: -            dp[index + v] = min(l[index + v], item + w) -    l = dp[:] -ans = 0 -for index, item in enumerate(l): -    if item != 10**10: -        ans = index -    else: -        continue -print(ans) +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