# temp

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

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



dp = [0] + [float("inf")]*(10**5)

for i in range(n):

    for j in range(10**5,wv[i][1]-1,-1):

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



res = 0

for v,e in enumerate(dp):

    if e <= w:

        res = v

print(res)
# dpE - Knapsack 2

import sys

input = sys.stdin.readline



def main():

    n, W = tuple(map(int, input().rstrip().split()))

    A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))

    _, v = list(zip(*A))

    lim = sum(v)

    dp = [0] + [float("inf")] * lim

    for i in range(n):

        for j in range(lim, A[i][1] - 1, -1):

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

    ans = max(v for v, w in enumerate(dp) if w <= W)

    print(ans)





if __name__ == "__main__":

    main()
# temp
n, w = list(map(int, input().split()))
wv = [tuple(map(int, input().split())) for i in range(n)]
dp = [0] + [float("inf")] * (10**5)
for i in range(n):
    for j in range(10**5, wv[i][1] - 1, -1):
        dp[j] = min(dp[j], dp[j - wv[i][1]] + wv[i][0])
res = 0
for v, e in enumerate(dp):
    if e <= w:
        res = v
print(res)

# dpE - Knapsack 2
import sys

input = sys.stdin.readline


def main():
    n, W = tuple(map(int, input().rstrip().split()))
    A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
    _, v = list(zip(*A))
    lim = sum(v)
    dp = [0] + [float("inf")] * lim
    for i in range(n):
        for j in range(lim, A[i][1] - 1, -1):
            dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])
    ans = max(v for v, w in enumerate(dp) if w <= W)
    print(ans)


if __name__ == "__main__":
    main()

-# temp -n, w = list(map(int, input().split())) -wv = [tuple(map(int, input().split())) for i in range(n)] -dp = [0] + [float("inf")] * (10**5) -for i in range(n): -    for j in range(10**5, wv[i][1] - 1, -1): -        dp[j] = min(dp[j], dp[j - wv[i][1]] + wv[i][0]) -res = 0 -for v, e in enumerate(dp): -    if e <= w: -        res = v -print(res) +# dpE - Knapsack 2 +import sys + +input = sys.stdin.readline + + +def main(): +    n, W = tuple(map(int, input().rstrip().split())) +    A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n)) +    _, v = list(zip(*A)) +    lim = sum(v) +    dp = [0] + [float("inf")] * lim +    for i in range(n): +        for j in range(lim, A[i][1] - 1, -1): +            dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0]) +    ans = max(v for v, w in enumerate(dp) if w <= W) +    print(ans) + + +if __name__ == "__main__": +    main()