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

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

W, V = list(zip(*WV))

M = sum(V) + 1

#M = 100100

INF = 1 << 60

dp = list([INF] * M for _ in range(n + 1))

dp[0][0] = 0

for i in range(n):

    for v in range(M):

        if v >= V[i]:

            dp[i + 1][v] = min(dp[i][v], dp[i][v - V[i]] + W[i])

        else:

            dp[i + 1][v] = dp[i][v]

for v in range(M):

    if dp[n][v] <= max_weight:

        ans = v

print(ans)

import numpy as np



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

WV = np.array([input().split() for _ in range(N)], np.int64)

V = sum(WV[:, 1])

INF = 1 << 60

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

dp[0] = 0

for w, v in WV:

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

for v in range(V + 1):

    if dp[v] <= W:

        ans = v

print(ans)

n, max_weight = list(map(int, input().split()))
WV = [list(map(int, input().split())) for _ in range(n)]
W, V = list(zip(*WV))
M = sum(V) + 1
# M = 100100
INF = 1 << 60
dp = list([INF] * M for _ in range(n + 1))
dp[0][0] = 0
for i in range(n):
    for v in range(M):
        if v >= V[i]:
            dp[i + 1][v] = min(dp[i][v], dp[i][v - V[i]] + W[i])
        else:
            dp[i + 1][v] = dp[i][v]
for v in range(M):
    if dp[n][v] <= max_weight:
        ans = v
print(ans)

import numpy as np

N, W = list(map(int, input().split()))
WV = np.array([input().split() for _ in range(N)], np.int64)
V = sum(WV[:, 1])
INF = 1 << 60
dp = np.full(V + 1, INF)
dp[0] = 0
for w, v in WV:
    np.minimum(dp[v:], dp[:-v] + w, out=dp[v:])
for v in range(V + 1):
    if dp[v] <= W:
        ans = v
print(ans)

-n, max_weight = list(map(int, input().split())) -WV = [list(map(int, input().split())) for _ in range(n)] -W, V = list(zip(*WV)) -M = sum(V) + 1 -# M = 100100 +import numpy as np + +N, W = list(map(int, input().split())) +WV = np.array([input().split() for _ in range(N)], np.int64) +V = sum(WV[:, 1]) -dp = list([INF] * M for _ in range(n + 1)) -dp[0][0] = 0 -for i in range(n): -    for v in range(M): -        if v >= V[i]: -            dp[i + 1][v] = min(dp[i][v], dp[i][v - V[i]] + W[i]) -        else: -            dp[i + 1][v] = dp[i][v] -for v in range(M): -    if dp[n][v] <= max_weight: +dp = np.full(V + 1, INF) +dp[0] = 0 +for w, v in WV: +    np.minimum(dp[v:], dp[:-v] + w, out=dp[v:]) +for v in range(V + 1): +    if dp[v] <= W: