import sys

from collections import Counter, deque, defaultdict

from itertools import accumulate, permutations, combinations, takewhile, compress, cycle

from functools import reduce

from math import ceil, floor, log10, log2, factorial

from pprint import pprint



sys.setrecursionlimit(1000000)

# MOD = 10 ** 9 + 7

# N = int(input())

# A = [int(x) for x in input().split()]

# V = [[0] * 100 for _ in range(100)]

# A = [int(input()) for _ in range(N)]



N, W = [int(x) for x in input().split()]



dp = [float('inf')] * 1000 * 100*10

vs = set()

vs.add(0)

dp[0] = 0



for i in range(N):

    w, v = [int(x) for x in input().split()]



    tmpDP = dp.copy()

    for vv in list(vs):

        if dp[vv + v] > dp[vv] + w:

            tmpDP[vv + v] = dp[vv] + w

            vs.add(vv + v)

    dp = tmpDP





ans = 0

for v in list(vs):

    if dp[v] <= W:

        ans = max(ans, v)

print(ans)

import sys

from collections import Counter, deque, defaultdict

from itertools import accumulate, permutations, combinations, takewhile, compress, cycle

from functools import reduce

from math import ceil, floor, log10, log2, factorial

from pprint import pprint



sys.setrecursionlimit(1000000)

# MOD = 10 ** 9 + 7

# N = int(input())

# A = [int(x) for x in input().split()]

# V = [[0] * 100 for _ in range(100)]

# A = [int(input()) for _ in range(N)]



N, W = [int(x) for x in input().split()]



dp = defaultdict(lambda: float('inf'))

dp[0] = 0



for i in range(N):

    w, v = [int(x) for x in input().split()]



    add = defaultdict(lambda: float('inf'))

    for vv in list(dp.keys()):

        if dp[vv + v] > dp[vv] + w:

            add[vv + v] = dp[vv] + w

    dp.update(add)



print((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x:x[0])[0]))

import sys
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
from functools import reduce
from math import ceil, floor, log10, log2, factorial
from pprint import pprint

sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
N, W = [int(x) for x in input().split()]
dp = [float("inf")] * 1000 * 100 * 10
vs = set()
vs.add(0)
dp[0] = 0
for i in range(N):
    w, v = [int(x) for x in input().split()]
    tmpDP = dp.copy()
    for vv in list(vs):
        if dp[vv + v] > dp[vv] + w:
            tmpDP[vv + v] = dp[vv] + w
            vs.add(vv + v)
    dp = tmpDP
ans = 0
for v in list(vs):
    if dp[v] <= W:
        ans = max(ans, v)
print(ans)

import sys
from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
from functools import reduce
from math import ceil, floor, log10, log2, factorial
from pprint import pprint

sys.setrecursionlimit(1000000)
# MOD = 10 ** 9 + 7
# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
N, W = [int(x) for x in input().split()]
dp = defaultdict(lambda: float("inf"))
dp[0] = 0
for i in range(N):
    w, v = [int(x) for x in input().split()]
    add = defaultdict(lambda: float("inf"))
    for vv in list(dp.keys()):
        if dp[vv + v] > dp[vv] + w:
            add[vv + v] = dp[vv] + w
    dp.update(add)
print((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x: x[0])[0]))

-dp = [float("inf")] * 1000 * 100 * 10 -vs = set() -vs.add(0) +dp = defaultdict(lambda: float("inf")) -    tmpDP = dp.copy() -    for vv in list(vs): +    add = defaultdict(lambda: float("inf")) +    for vv in list(dp.keys()): -            tmpDP[vv + v] = dp[vv] + w -            vs.add(vv + v) -    dp = tmpDP -ans = 0 -for v in list(vs): -    if dp[v] <= W: -        ans = max(ans, v) -print(ans) +            add[vv + v] = dp[vv] + w +    dp.update(add) +print((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x: x[0])[0]))