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

INF=10**9+1

import numpy as np

dp=np.full(N*1000+1,INF,dtype=int)

dp[0]=0

for i in range(N):

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

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



for i in range(len(dp)-1,-1,-1):

  if dp[i]<=W:

    print(i)

    break

import sys

readline = sys.stdin.readline



import numpy as np

import math



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



dp = np.array([10 ** 12 + 1] * (10 ** 5 + 1), dtype = int)

dp[0] = 0



for i in range(N):

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

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

  

for i in range(len(dp) - 1,-1,-1):

  if dp[i] <= W:

    print(i)

    break
N, W = list(map(int, input().split()))
INF = 10**9 + 1
import numpy as np

dp = np.full(N * 1000 + 1, INF, dtype=int)
dp[0] = 0
for i in range(N):
    w, v = list(map(int, input().split()))
    np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
for i in range(len(dp) - 1, -1, -1):
    if dp[i] <= W:
        print(i)
        break

import sys

readline = sys.stdin.readline
import numpy as np
import math

N, W = list(map(int, readline().split()))
dp = np.array([10**12 + 1] * (10**5 + 1), dtype=int)
dp[0] = 0
for i in range(N):
    w, v = list(map(int, readline().split()))
    np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
for i in range(len(dp) - 1, -1, -1):
    if dp[i] <= W:
        print(i)
        break

-N, W = list(map(int, input().split())) -INF = 10**9 + 1 +import sys + +readline = sys.stdin.readline +import math -dp = np.full(N * 1000 + 1, INF, dtype=int) +N, W = list(map(int, readline().split())) +dp = np.array([10**12 + 1] * (10**5 + 1), dtype=int) -    w, v = list(map(int, input().split())) +    w, v = list(map(int, readline().split()))