from sys import stdin, stdout

from collections import deque, defaultdict

import math as m



rl = lambda: stdin.readline()

rll = lambda: stdin.readline().split()

rli = lambda: list(map(int, stdin.readline().split()))



INF, NINF = float('inf'), float('-inf')



def main():

	n, W = rli()

	items = []

	maxval = 0

	for _ in range(n):

		w, v = rli()

		maxval += v

		items.append((w, v))



	dp = [INF for _ in range(maxval + 1)]

	dp[0] = 0

	for w, v in items:

		for i in range(maxval, -1, -1):

			if i - v >= 0:

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

	ans = NINF

	for val, minweight in enumerate(dp):

		if minweight <= W:

			ans = val

	print(ans)

	stdout.close()



if __name__ == "__main__":

	main()
from sys import stdin, stdout, setrecursionlimit

from collections import deque, defaultdict, Counter

from heapq import heappush, heappop

import math



rl = lambda: stdin.readline()

rll = lambda: stdin.readline().split()

rli = lambda: list(map(int, stdin.readline().split()))

rlf = lambda: list(map(float, stdin.readline().split()))



INF, NINF = float('inf'), float('-inf')

def pprint(M):

	for row in M:

		print(row)

	print("~~~")





def main():

	n, W = rli()

	weights, vals = [], []

	for _ in range(n):

		w, v = rli()

		weights.append(w)

		vals.append(v)

	maxval = 10**5 + 100

	dp = [INF for _ in range(maxval+1)]

	dp[0] = 0

	for w, v in zip(weights, vals):

		for i in range(maxval, -1, -1):

			if i - v < 0: continue

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

	for i in range(maxval, -1, -1):

		if dp[i] <= W:

			print(i)

			break

	stdout.close()



if __name__ == "__main__":

	main()
from sys import stdin, stdout
from collections import deque, defaultdict
import math as m

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
INF, NINF = float("inf"), float("-inf")


def main():
    n, W = rli()
    items = []
    maxval = 0
    for _ in range(n):
        w, v = rli()
        maxval += v
        items.append((w, v))
    dp = [INF for _ in range(maxval + 1)]
    dp[0] = 0
    for w, v in items:
        for i in range(maxval, -1, -1):
            if i - v >= 0:
                dp[i] = min(dp[i], dp[i - v] + w)
    ans = NINF
    for val, minweight in enumerate(dp):
        if minweight <= W:
            ans = val
    print(ans)
    stdout.close()


if __name__ == "__main__":
    main()

from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
import math

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: list(map(int, stdin.readline().split()))
rlf = lambda: list(map(float, stdin.readline().split()))
INF, NINF = float("inf"), float("-inf")


def pprint(M):
    for row in M:
        print(row)
    print("~~~")


def main():
    n, W = rli()
    weights, vals = [], []
    for _ in range(n):
        w, v = rli()
        weights.append(w)
        vals.append(v)
    maxval = 10**5 + 100
    dp = [INF for _ in range(maxval + 1)]
    dp[0] = 0
    for w, v in zip(weights, vals):
        for i in range(maxval, -1, -1):
            if i - v < 0:
                continue
            dp[i] = min(dp[i], dp[i - v] + w)
    for i in range(maxval, -1, -1):
        if dp[i] <= W:
            print(i)
            break
    stdout.close()


if __name__ == "__main__":
    main()

-from sys import stdin, stdout -from collections import deque, defaultdict -import math as m +from sys import stdin, stdout, setrecursionlimit +from collections import deque, defaultdict, Counter +from heapq import heappush, heappop +import math +rlf = lambda: list(map(float, stdin.readline().split())) + + +def pprint(M): +    for row in M: +        print(row) +    print("~~~") -    items = [] -    maxval = 0 +    weights, vals = [], [] -        maxval += v -        items.append((w, v)) +        weights.append(w) +        vals.append(v) +    maxval = 10**5 + 100 -    for w, v in items: +    for w, v in zip(weights, vals): -            if i - v >= 0: -                dp[i] = min(dp[i], dp[i - v] + w) -    ans = NINF -    for val, minweight in enumerate(dp): -        if minweight <= W: -            ans = val -    print(ans) +            if i - v < 0: +                continue +            dp[i] = min(dp[i], dp[i - v] + w) +    for i in range(maxval, -1, -1): +        if dp[i] <= W: +            print(i) +            break