#EDP-E

import sys

from collections import defaultdict

n, W = list(map(int, sys.stdin.readline().split()))



dp = [defaultdict(int) for _ in range(n)]

w, v = list(map(int, sys.stdin.readline().split()))

dp[0][v] = w



for i in range(1, n):

    w, v = list(map(int, sys.stdin.readline().split()))

    for vb, wb in list(dp[i-1].items()):

        dp[i][vb] = min(wb, dp[i].get(vb, wb))

        tmp = min(wb + w, dp[i].get(vb+ v, wb + w))

        if tmp <=W:

            dp[i][v+ vb] = tmp

    dp[i][v] = min(dp[i].get(v, w), w)



#print(dp[-1].items())

print((max(dp[-1].keys())))

#DP-E

def main():

    import sys, copy

    N, W = list(map(int, sys.stdin.readline().split()))

    L = tuple([tuple(map(int, sys.stdin.readline().split())) for _ in range(N)])

    #print(L)

    #価値テーブルを作成

    dp =[[10**11+1 for _ in range(10**5+1)] for _ in range(N)]

    dp[0][L[0][1]] = L[0][0] #初期設定

    #print(dp)

    for i in range(1, N):

        #1. 前回のコピー

        dp[i] = copy.copy(dp[i-1]) 

        w, v = L[i][0], L[i][1]

        #print(w, v)

        #2. 今回の荷物の更新

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

        #3. 前回の荷物 + 今回の荷物の更新

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

            if dp[i-1][j] !=0:

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

    

    

    

    ans = 0

    for v1,w1 in enumerate(dp[-1]):

        if w1 <= W:

            if ans < v1:

                ans = v1

            #print(v1, w1)

    print(ans)



if __name__ =='__main__':

    main()
# EDP-E
import sys
from collections import defaultdict

n, W = list(map(int, sys.stdin.readline().split()))
dp = [defaultdict(int) for _ in range(n)]
w, v = list(map(int, sys.stdin.readline().split()))
dp[0][v] = w
for i in range(1, n):
    w, v = list(map(int, sys.stdin.readline().split()))
    for vb, wb in list(dp[i - 1].items()):
        dp[i][vb] = min(wb, dp[i].get(vb, wb))
        tmp = min(wb + w, dp[i].get(vb + v, wb + w))
        if tmp <= W:
            dp[i][v + vb] = tmp
    dp[i][v] = min(dp[i].get(v, w), w)
# print(dp[-1].items())
print((max(dp[-1].keys())))

# DP-E
def main():
    import sys, copy

    N, W = list(map(int, sys.stdin.readline().split()))
    L = tuple([tuple(map(int, sys.stdin.readline().split())) for _ in range(N)])
    # print(L)
    # 価値テーブルを作成
    dp = [[10**11 + 1 for _ in range(10**5 + 1)] for _ in range(N)]
    dp[0][L[0][1]] = L[0][0]  # 初期設定
    # print(dp)
    for i in range(1, N):
        # 1. 前回のコピー
        dp[i] = copy.copy(dp[i - 1])
        w, v = L[i][0], L[i][1]
        # print(w, v)
        # 2. 今回の荷物の更新
        dp[i][v] = min(w, dp[i][v])
        # 3. 前回の荷物 + 今回の荷物の更新
        for j in range(10**5 + 1 - v):
            if dp[i - 1][j] != 0:
                dp[i][v + j] = min(dp[i][v + j], w + dp[i - 1][j])
    ans = 0
    for v1, w1 in enumerate(dp[-1]):
        if w1 <= W:
            if ans < v1:
                ans = v1
            # print(v1, w1)
    print(ans)


if __name__ == "__main__":
    main()

-# EDP-E -import sys -from collections import defaultdict +# DP-E +def main(): +    import sys, copy -n, W = list(map(int, sys.stdin.readline().split())) -dp = [defaultdict(int) for _ in range(n)] -w, v = list(map(int, sys.stdin.readline().split())) -dp[0][v] = w -for i in range(1, n): -    w, v = list(map(int, sys.stdin.readline().split())) -    for vb, wb in list(dp[i - 1].items()): -        dp[i][vb] = min(wb, dp[i].get(vb, wb)) -        tmp = min(wb + w, dp[i].get(vb + v, wb + w)) -        if tmp <= W: -            dp[i][v + vb] = tmp -    dp[i][v] = min(dp[i].get(v, w), w) -# print(dp[-1].items()) -print((max(dp[-1].keys()))) +    N, W = list(map(int, sys.stdin.readline().split())) +    L = tuple([tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]) +    # print(L) +    # 価値テーブルを作成 +    dp = [[10**11 + 1 for _ in range(10**5 + 1)] for _ in range(N)] +    dp[0][L[0][1]] = L[0][0]  # 初期設定 +    # print(dp) +    for i in range(1, N): +        # 1. 前回のコピー +        dp[i] = copy.copy(dp[i - 1]) +        w, v = L[i][0], L[i][1] +        # print(w, v) +        # 2. 今回の荷物の更新 +        dp[i][v] = min(w, dp[i][v]) +        # 3. 前回の荷物 + 今回の荷物の更新 +        for j in range(10**5 + 1 - v): +            if dp[i - 1][j] != 0: +                dp[i][v + j] = min(dp[i][v + j], w + dp[i - 1][j]) +    ans = 0 +    for v1, w1 in enumerate(dp[-1]): +        if w1 <= W: +            if ans < v1: +                ans = v1 +            # print(v1, w1) +    print(ans) + + +if __name__ == "__main__": +    main()