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

w = []

v = []

sum_value = 0

inf = 10**9 + 1

for _ in range(N):

    w_, v_ = list(map(int, input().split()))

    w.append(w_)

    v.append(v_)

    sum_value += v_



"""

dp[n][i]: n個目までの品物から価値の総量がiよりも大きくなるように選択したときの, 重さの最小値

"""



dp = [[inf] * (sum_value+1) for _ in range(N+1)]

dp[0][0] = 0





for n in range(1, N+1):

    for i in range(sum_value+1):

        if i >= v[n-1]:

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

        else:

            dp[n][i] = dp[n-1][i]

for i in range(sum_value+1)[::-1]:

    if dp[N][i] != inf and dp[N][i] <= W:

        print(i)

        break

import sys

input = sys.stdin.readline



def main():

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

    inf = float('inf')

    dp = [inf] * (10**5+1)

    dp[0] = 0

    for n in range(1, N+1):

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

        for i in range(v, 10**5+1)[::-1]:

            if dp[i-v] + w <= W:

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

    for i in range(10**5+1)[::-1]:

        if dp[i] < inf:

            print(i)

            break

if __name__ == '__main__':

    main()
N, W = list(map(int, input().split()))
w = []
v = []
sum_value = 0
inf = 10**9 + 1
for _ in range(N):
    w_, v_ = list(map(int, input().split()))
    w.append(w_)
    v.append(v_)
    sum_value += v_
"""
dp[n][i]: n個目までの品物から価値の総量がiよりも大きくなるように選択したときの, 重さの最小値
"""
dp = [[inf] * (sum_value + 1) for _ in range(N + 1)]
dp[0][0] = 0
for n in range(1, N + 1):
    for i in range(sum_value + 1):
        if i >= v[n - 1]:
            dp[n][i] = min(dp[n - 1][i], dp[n - 1][i - v[n - 1]] + w[n - 1])
        else:
            dp[n][i] = dp[n - 1][i]
for i in range(sum_value + 1)[::-1]:
    if dp[N][i] != inf and dp[N][i] <= W:
        print(i)
        break

import sys

input = sys.stdin.readline


def main():
    N, W = list(map(int, input().split()))
    inf = float("inf")
    dp = [inf] * (10**5 + 1)
    dp[0] = 0
    for n in range(1, N + 1):
        w, v = list(map(int, input().split()))
        for i in range(v, 10**5 + 1)[::-1]:
            if dp[i - v] + w <= W:
                dp[i] = min(dp[i], dp[i - v] + w)
    for i in range(10**5 + 1)[::-1]:
        if dp[i] < inf:
            print(i)
            break


if __name__ == "__main__":
    main()

-N, W = list(map(int, input().split())) -w = [] -v = [] -sum_value = 0 -inf = 10**9 + 1 -for _ in range(N): -    w_, v_ = list(map(int, input().split())) -    w.append(w_) -    v.append(v_) -    sum_value += v_ -""" -dp[n][i]: n個目までの品物から価値の総量がiよりも大きくなるように選択したときの, 重さの最小値 -""" -dp = [[inf] * (sum_value + 1) for _ in range(N + 1)] -dp[0][0] = 0 -for n in range(1, N + 1): -    for i in range(sum_value + 1): -        if i >= v[n - 1]: -            dp[n][i] = min(dp[n - 1][i], dp[n - 1][i - v[n - 1]] + w[n - 1]) -        else: -            dp[n][i] = dp[n - 1][i] -for i in range(sum_value + 1)[::-1]: -    if dp[N][i] != inf and dp[N][i] <= W: -        print(i) -        break +import sys + +input = sys.stdin.readline + + +def main(): +    N, W = list(map(int, input().split())) +    inf = float("inf") +    dp = [inf] * (10**5 + 1) +    dp[0] = 0 +    for n in range(1, N + 1): +        w, v = list(map(int, input().split())) +        for i in range(v, 10**5 + 1)[::-1]: +            if dp[i - v] + w <= W: +                dp[i] = min(dp[i], dp[i - v] + w) +    for i in range(10**5 + 1)[::-1]: +        if dp[i] < inf: +            print(i) +            break + + +if __name__ == "__main__": +    main()