import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



import numpy as np



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

m = list(map(int,read().split()))

WV = list(zip(m,m))



# 価値 -> 最小重さ

INF = 10**18

dp = np.full(10**5+10,INF,np.int64)



dp[0] = 0

for w,v in WV:

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



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

print(answer)
import sys

import numpy as np



read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



N, lim = list(map(int, readline().split()))

WV = np.array(read().split(), np.int64)



W = WV[::2]

V = WV[1::2]



# value sum -> min weight

INF = 10**18

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

dp[0] = 0

for w, v in zip(W, V):

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



answer = np.where(dp <= lim)[0].max()

print(answer)
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

N, W = list(map(int, readline().split()))
m = list(map(int, read().split()))
WV = list(zip(m, m))
# 価値 -> 最小重さ
INF = 10**18
dp = np.full(10**5 + 10, INF, np.int64)
dp[0] = 0
for w, v in WV:
    np.minimum(dp[v:], dp[:-v].copy() + w, out=dp[v:])
answer = np.where(dp <= W)[0][-1]
print(answer)

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, lim = list(map(int, readline().split()))
WV = np.array(read().split(), np.int64)
W = WV[::2]
V = WV[1::2]
# value sum -> min weight
INF = 10**18
dp = np.full(V.sum() + 1, INF, np.int64)
dp[0] = 0
for w, v in zip(W, V):
    np.minimum(dp[v:], dp[:-v] + w, out=dp[v:])
answer = np.where(dp <= lim)[0].max()
print(answer)

+import numpy as np -import numpy as np - -N, W = list(map(int, readline().split())) -m = list(map(int, read().split())) -WV = list(zip(m, m)) -# 価値 -> 最小重さ +N, lim = list(map(int, readline().split())) +WV = np.array(read().split(), np.int64) +W = WV[::2] +V = WV[1::2] +# value sum -> min weight -dp = np.full(10**5 + 10, INF, np.int64) +dp = np.full(V.sum() + 1, INF, np.int64) -for w, v in WV: -    np.minimum(dp[v:], dp[:-v].copy() + w, out=dp[v:]) -answer = np.where(dp <= W)[0][-1] +for w, v in zip(W, V): +    np.minimum(dp[v:], dp[:-v] + w, out=dp[v:]) +answer = np.where(dp <= lim)[0].max()