import numpy as np



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

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

INF = 10 ** 18

V_MAX = 10 ** 3 * N



dp = np.full(V_MAX + 1, INF)

dp[0] = 0



for w, v in wv:

    dp[v:] = np.minimum(dp[v:], dp[:-v] + w)



ans = 0

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

    if dp[i] <= W:

        ans = i

        break



print(ans)

import numpy as np



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

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

INF = 10 ** 18

V_MAX = 10 ** 3 * N



dp = np.full(V_MAX + 1, INF)

dp[0] = 0



for w, v in wv:

    dp[v:] = np.minimum(dp[v:], dp[:-v] + w)



ans = np.where(dp <= W)[0].max()

print(ans)

import numpy as np

N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(N)]
INF = 10**18
V_MAX = 10**3 * N
dp = np.full(V_MAX + 1, INF)
dp[0] = 0
for w, v in wv:
    dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
ans = 0
for i in range(V_MAX, -1, -1):
    if dp[i] <= W:
        ans = i
        break
print(ans)

import numpy as np

N, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(N)]
INF = 10**18
V_MAX = 10**3 * N
dp = np.full(V_MAX + 1, INF)
dp[0] = 0
for w, v in wv:
    dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
ans = np.where(dp <= W)[0].max()
print(ans)

-ans = 0 -for i in range(V_MAX, -1, -1): -    if dp[i] <= W: -        ans = i -        break +ans = np.where(dp <= W)[0].max()