#!/usr/bin/env python3

def main():

    import numpy as np



    np.set_printoptions(linewidth=200)



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

    lst = [list(map(int, input().split())) for _ in range(N)]

    v_max = 10 ** 3 * 100 * 10

    w_max = 10 ** 9 * v_max



    # i以上の価値を持つときの最小重量

    dp = np.full(v_max, w_max, dtype=np.int64)

    # initialize

    dp[0] = 0



    for n in range(N):

        w, v = lst[n]

        dp[v:] = np.minimum(dp[v:], dp[:-v] + w)



    ans = 0

    for i, w in enumerate(dp):

        if w <= W:

            ans = i

    print(ans)





if __name__ == '__main__':

    main()

#!/usr/bin/env python3

def main():

    import numpy as np



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

    lst = [list(map(int, input().split())) for _ in range(N)]

    v_max = 10 ** 3 * 100 * 10

    w_max = 10 ** 9 * v_max



    # i以上の価値を持つときの最小重量

    dp = np.full(v_max, w_max, dtype=np.int64)

    # initialize

    dp[0] = 0



    for w, v in lst:

        dp[v:] = np.minimum(dp[v:], dp[:-v] + w)



    print((np.asarray(dp <= W).nonzero()[0].max()))





if __name__ == '__main__':

    main()

#!/usr/bin/env python3
def main():
    import numpy as np

    np.set_printoptions(linewidth=200)
    N, W = list(map(int, input().split()))
    lst = [list(map(int, input().split())) for _ in range(N)]
    v_max = 10**3 * 100 * 10
    w_max = 10**9 * v_max
    # i以上の価値を持つときの最小重量
    dp = np.full(v_max, w_max, dtype=np.int64)
    # initialize
    dp[0] = 0
    for n in range(N):
        w, v = lst[n]
        dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
    ans = 0
    for i, w in enumerate(dp):
        if w <= W:
            ans = i
    print(ans)


if __name__ == "__main__":
    main()

#!/usr/bin/env python3
def main():
    import numpy as np

    N, W = list(map(int, input().split()))
    lst = [list(map(int, input().split())) for _ in range(N)]
    v_max = 10**3 * 100 * 10
    w_max = 10**9 * v_max
    # i以上の価値を持つときの最小重量
    dp = np.full(v_max, w_max, dtype=np.int64)
    # initialize
    dp[0] = 0
    for w, v in lst:
        dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
    print((np.asarray(dp <= W).nonzero()[0].max()))


if __name__ == "__main__":
    main()

-    np.set_printoptions(linewidth=200) -    for n in range(N): -        w, v = lst[n] +    for w, v in lst: -    ans = 0 -    for i, w in enumerate(dp): -        if w <= W: -            ans = i -    print(ans) +    print((np.asarray(dp <= W).nonzero()[0].max()))