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

w=[]

v=[]



for i in range(N):

    x,y=list(map(int,input().split()))

    w.append(x)

    v.append(y)



S=sum(v)



DP=[[1000000000000]*(S+1) for i in range(N+1)]

for i in range(N+1):

    DP[i][0]=0







for i in range(N):

    for v1 in range(S+1):

        DP[i+1][v1]=min(DP[i][v1-v[i]]+w[i],DP[i][v1])



for i in range(S,0,-1):

    if DP[N][i]<=W:

        print(i)

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

w=[]

v=[]



for i in range(N):

    x,y=list(map(int,input().split()))

    w.append(x)

    v.append(y)



S=sum(v)



DP=[1000000000000]*(S+1)

DP[0]=0





for i in range(N):

    for v1 in range(S,v[i]-1,-1):

        DP[v1]=min(DP[v1-v[i]]+w[i],DP[v1])



for i in range(S,0,-1):

    if DP[i]<=W:

        print(i)

        exit()
N, W = list(map(int, input().split()))
w = []
v = []
for i in range(N):
    x, y = list(map(int, input().split()))
    w.append(x)
    v.append(y)
S = sum(v)
DP = [[1000000000000] * (S + 1) for i in range(N + 1)]
for i in range(N + 1):
    DP[i][0] = 0
for i in range(N):
    for v1 in range(S + 1):
        DP[i + 1][v1] = min(DP[i][v1 - v[i]] + w[i], DP[i][v1])
for i in range(S, 0, -1):
    if DP[N][i] <= W:
        print(i)
        exit()

N, W = list(map(int, input().split()))
w = []
v = []
for i in range(N):
    x, y = list(map(int, input().split()))
    w.append(x)
    v.append(y)
S = sum(v)
DP = [1000000000000] * (S + 1)
DP[0] = 0
for i in range(N):
    for v1 in range(S, v[i] - 1, -1):
        DP[v1] = min(DP[v1 - v[i]] + w[i], DP[v1])
for i in range(S, 0, -1):
    if DP[i] <= W:
        print(i)
        exit()

-DP = [[1000000000000] * (S + 1) for i in range(N + 1)] -for i in range(N + 1): -    DP[i][0] = 0 +DP = [1000000000000] * (S + 1) +DP[0] = 0 -    for v1 in range(S + 1): -        DP[i + 1][v1] = min(DP[i][v1 - v[i]] + w[i], DP[i][v1]) +    for v1 in range(S, v[i] - 1, -1): +        DP[v1] = min(DP[v1 - v[i]] + w[i], DP[v1]) -    if DP[N][i] <= W: +    if DP[i] <= W: