import sys

sys.setrecursionlimit(2147483647)

INF=float("inf")

MOD=10**9+7

input=lambda :sys.stdin.readline().rstrip()

def resolve():

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

    w,v=[0]*n,[0]*n

    for i in range(n):

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

    V=sum(v)

    dp=[INF]*(V+1)

    dp[0]=0

    for i in range(n):

        newdp=dp[:]

        for x in range(V+1):

            if(x+v[i]<V+1):

                newdp[x+v[i]]=min(newdp[x+v[i]],dp[x]+w[i])

        dp=newdp

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

        if(dp[i]<=W):

            print(i)

            return

resolve()
import sys

sys.setrecursionlimit(2147483647)

INF=float("inf")

MOD=10**9+7

input=lambda :sys.stdin.readline().rstrip()

def resolve():

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

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



    V=100000

    dp=[INF]*(V+1)

    dp[0]=0



    for w,v in WV:

        for x in range(V,-1,-1):

            if(x+v<=V):

                dp[x+v]=min(dp[x+v],dp[x]+w)



    for x in range(V,-1,-1):

        if(dp[x]<=W):

            print(x)

            return

resolve()
import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()


def resolve():
    n, W = list(map(int, input().split()))
    w, v = [0] * n, [0] * n
    for i in range(n):
        w[i], v[i] = list(map(int, input().split()))
    V = sum(v)
    dp = [INF] * (V + 1)
    dp[0] = 0
    for i in range(n):
        newdp = dp[:]
        for x in range(V + 1):
            if x + v[i] < V + 1:
                newdp[x + v[i]] = min(newdp[x + v[i]], dp[x] + w[i])
        dp = newdp
    for i in range(V, -1, -1):
        if dp[i] <= W:
            print(i)
            return


resolve()

import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()


def resolve():
    n, W = list(map(int, input().split()))
    WV = [tuple(map(int, input().split())) for _ in range(n)]
    V = 100000
    dp = [INF] * (V + 1)
    dp[0] = 0
    for w, v in WV:
        for x in range(V, -1, -1):
            if x + v <= V:
                dp[x + v] = min(dp[x + v], dp[x] + w)
    for x in range(V, -1, -1):
        if dp[x] <= W:
            print(x)
            return


resolve()

-    w, v = [0] * n, [0] * n -    for i in range(n): -        w[i], v[i] = list(map(int, input().split())) -    V = sum(v) +    WV = [tuple(map(int, input().split())) for _ in range(n)] +    V = 100000 -    for i in range(n): -        newdp = dp[:] -        for x in range(V + 1): -            if x + v[i] < V + 1: -                newdp[x + v[i]] = min(newdp[x + v[i]], dp[x] + w[i]) -        dp = newdp -    for i in range(V, -1, -1): -        if dp[i] <= W: -            print(i) +    for w, v in WV: +        for x in range(V, -1, -1): +            if x + v <= V: +                dp[x + v] = min(dp[x + v], dp[x] + w) +    for x in range(V, -1, -1): +        if dp[x] <= W: +            print(x)