#E

inf = float("inf")

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

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



dp = [[inf for j in range(10**5+1)] for i in range(N+1)] #dp[i][v] = W



for i in range(N):

    dp[i][0] = 0



for i in range(N):

    w,v = WV[i]

    for j in range(10**5+1):

        if j+v <= 10**5:

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

        dp[i+1][j] = min(dp[i][j],dp[i+1][j])



#print(dp)

ans = 0

for j in range(10**5+1):

    w = dp[N][j]

    if w <= W:

        ans = j

        

print(ans)





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

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

v_max = 10 ** 5

w_max = 10 ** 18

dp = [[w_max for _ in range(v_max + 1)] for _ in range(n + 1)]



for i in range(n):

    dp[i][0] = 0



for i in range(n):

    w_, v_ = wv[i]

    for j in range(v_max + 1):

        if j + v_ <= v_max:

            dp[i+1][j+v_] = min(dp[i][j] + w_, dp[i][j + v_])

        dp[i+1][j] = min(dp[i][j], dp[i+1][j])





ans = 0

for i in range(v_max + 1):

    w_ = dp[n][i]

    if w_ <= w:

        ans = i

print(ans)

# E
inf = float("inf")
N, W = list(map(int, input().split()))
WV = [list(map(int, input().split())) for _ in range(N)]
dp = [[inf for j in range(10**5 + 1)] for i in range(N + 1)]  # dp[i][v] = W
for i in range(N):
    dp[i][0] = 0
for i in range(N):
    w, v = WV[i]
    for j in range(10**5 + 1):
        if j + v <= 10**5:
            dp[i + 1][j + v] = min(dp[i][j] + w, dp[i][j + v])
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j])
# print(dp)
ans = 0
for j in range(10**5 + 1):
    w = dp[N][j]
    if w <= W:
        ans = j
print(ans)

n, w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]
v_max = 10**5
w_max = 10**18
dp = [[w_max for _ in range(v_max + 1)] for _ in range(n + 1)]
for i in range(n):
    dp[i][0] = 0
for i in range(n):
    w_, v_ = wv[i]
    for j in range(v_max + 1):
        if j + v_ <= v_max:
            dp[i + 1][j + v_] = min(dp[i][j] + w_, dp[i][j + v_])
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j])
ans = 0
for i in range(v_max + 1):
    w_ = dp[n][i]
    if w_ <= w:
        ans = i
print(ans)

-# E -inf = float("inf") -N, W = list(map(int, input().split())) -WV = [list(map(int, input().split())) for _ in range(N)] -dp = [[inf for j in range(10**5 + 1)] for i in range(N + 1)]  # dp[i][v] = W -for i in range(N): +n, w = list(map(int, input().split())) +wv = [list(map(int, input().split())) for _ in range(n)] +v_max = 10**5 +w_max = 10**18 +dp = [[w_max for _ in range(v_max + 1)] for _ in range(n + 1)] +for i in range(n): -for i in range(N): -    w, v = WV[i] -    for j in range(10**5 + 1): -        if j + v <= 10**5: -            dp[i + 1][j + v] = min(dp[i][j] + w, dp[i][j + v]) +for i in range(n): +    w_, v_ = wv[i] +    for j in range(v_max + 1): +        if j + v_ <= v_max: +            dp[i + 1][j + v_] = min(dp[i][j] + w_, dp[i][j + v_]) -# print(dp) -for j in range(10**5 + 1): -    w = dp[N][j] -    if w <= W: -        ans = j +for i in range(v_max + 1): +    w_ = dp[n][i] +    if w_ <= w: +        ans = i