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

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

dp = [ [float("inf")]*(10**5+1) for _ in range(n+1) ]

dp[0][0] = 0

for i in range(n):

  w, v = wv[i]

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

    if j < v:

      dp[i+1][j] = dp[i][j]

    else:

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

ans = 0

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

  if dp[n][j] <= W:

    ans = j

print(ans)
import numpy as np



U = 10**5

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

dp = np.full(U+1, float("inf"))

dp[0] = 0

for _ in range(n):

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

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

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

print(ans)
n, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [[float("inf")] * (10**5 + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(n):
    w, v = wv[i]
    for j in range(10**5 + 1):
        if j < v:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i][j - v] + w)
ans = 0
for j in range(10**5 + 1):
    if dp[n][j] <= W:
        ans = j
print(ans)

import numpy as np

U = 10**5
n, W = list(map(int, input().split()))
dp = np.full(U + 1, float("inf"))
dp[0] = 0
for _ in range(n):
    w, v = list(map(int, input().split()))
    np.minimum(dp[v:], dp[:-v] + w, out=dp[v:])
ans = np.where(dp <= W)[0][-1]
print(ans)

+import numpy as np + +U = 10**5 -wv = [list(map(int, input().split())) for _ in range(n)] -dp = [[float("inf")] * (10**5 + 1) for _ in range(n + 1)] -dp[0][0] = 0 -for i in range(n): -    w, v = wv[i] -    for j in range(10**5 + 1): -        if j < v: -            dp[i + 1][j] = dp[i][j] -        else: -            dp[i + 1][j] = min(dp[i][j], dp[i][j - v] + w) -ans = 0 -for j in range(10**5 + 1): -    if dp[n][j] <= W: -        ans = j +dp = np.full(U + 1, float("inf")) +dp[0] = 0 +for _ in range(n): +    w, v = list(map(int, input().split())) +    np.minimum(dp[v:], dp[:-v] + w, out=dp[v:]) +ans = np.where(dp <= W)[0][-1]