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

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



supremum = 10**5



dp = [float("inf") for i in range(supremum+1)]

dp[0] = 0



for i in range(N) :

    weight_i,value_i = L[i]    

    for j in range(supremum,value_i-1,-1) :

        if dp[j-value_i] < float("inf") :

            dp[j] = min(dp[j], dp[j-value_i] + weight_i)



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

    if dp[i] <= W :

        ans = i

        break



print(ans)

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

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



supremum = 10**5



dp = [float("inf") for i in range(supremum+1)]

dp[0] = 0



for i in range(N) :

    weight_i,value_i = L[i]    

    for value in range(supremum,value_i-1,-1) :

        if dp[value-value_i] + weight_i <= W :

            dp[value] = min(dp[value], dp[value-value_i] + weight_i)



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

    if dp[i] <= W :

        ans = i

        break



print(ans)



        
N, W = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(N)]
supremum = 10**5
dp = [float("inf") for i in range(supremum + 1)]
dp[0] = 0
for i in range(N):
    weight_i, value_i = L[i]
    for j in range(supremum, value_i - 1, -1):
        if dp[j - value_i] < float("inf"):
            dp[j] = min(dp[j], dp[j - value_i] + weight_i)
for i in range(supremum, -1, -1):
    if dp[i] <= W:
        ans = i
        break
print(ans)

N, W = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(N)]
supremum = 10**5
dp = [float("inf") for i in range(supremum + 1)]
dp[0] = 0
for i in range(N):
    weight_i, value_i = L[i]
    for value in range(supremum, value_i - 1, -1):
        if dp[value - value_i] + weight_i <= W:
            dp[value] = min(dp[value], dp[value - value_i] + weight_i)
for i in range(supremum, -1, -1):
    if dp[i] <= W:
        ans = i
        break
print(ans)

-    for j in range(supremum, value_i - 1, -1): -        if dp[j - value_i] < float("inf"): -            dp[j] = min(dp[j], dp[j - value_i] + weight_i) +    for value in range(supremum, value_i - 1, -1): +        if dp[value - value_i] + weight_i <= W: +            dp[value] = min(dp[value], dp[value - value_i] + weight_i)