# coding: utf-8

# Your code here!

n,W = [int(i) for i in input().split()]

wv = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行

V=10**5

MAX=10**12

dp = [MAX]*(V+1)

dp[0]=0

newdp = [MAX]*(V+1)

for i in range(n):

    w, v = wv[i]

    for j in range(V+1):

        newdp[j] = dp[j]

    for j in range(V+1):

        if j+v <= V:

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

    newdp, dp = dp, newdp

#    print(dp)



print((max([i for i,c in enumerate(dp) if c <= W])))





#print(dp)
# coding: utf-8

# Your code here!

n,W = [int(i) for i in input().split()]

wv = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行

V=10**5

MAX=10**12

dp = [MAX]*(V+1)

dp[0]=0

newdp = [MAX]*(V+1)

for i in range(n):

    w, v = wv[i]

    newdp = dp[:]

    for j in range(V+1):

        if j+v <= V:

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

    newdp, dp = dp, newdp

#    print(dp)



print((max([i for i,c in enumerate(dp) if c <= W])))





#print(dp)



# coding: utf-8
# Your code here!
n, W = [int(i) for i in input().split()]
wv = [[int(i) for i in input().split()] for j in range(n)]  # 縦「n」行
V = 10**5
MAX = 10**12
dp = [MAX] * (V + 1)
dp[0] = 0
newdp = [MAX] * (V + 1)
for i in range(n):
    w, v = wv[i]
    for j in range(V + 1):
        newdp[j] = dp[j]
    for j in range(V + 1):
        if j + v <= V:
            newdp[j + v] = min(dp[j] + w, newdp[j + v])
    newdp, dp = dp, newdp
#    print(dp)
print((max([i for i, c in enumerate(dp) if c <= W])))
# print(dp)

# coding: utf-8
# Your code here!
n, W = [int(i) for i in input().split()]
wv = [[int(i) for i in input().split()] for j in range(n)]  # 縦「n」行
V = 10**5
MAX = 10**12
dp = [MAX] * (V + 1)
dp[0] = 0
newdp = [MAX] * (V + 1)
for i in range(n):
    w, v = wv[i]
    newdp = dp[:]
    for j in range(V + 1):
        if j + v <= V:
            newdp[j + v] = min(dp[j] + w, newdp[j + v])
    newdp, dp = dp, newdp
#    print(dp)
print((max([i for i, c in enumerate(dp) if c <= W])))
# print(dp)

-    for j in range(V + 1): -        newdp[j] = dp[j] +    newdp = dp[:]