import sys



import numba as nb

import numpy as np



input = sys.stdin.readline





@nb.njit("i8(i8,i8,i8[:],i8[:])")

def solve(N, W, w, v):

    dp = np.full(shape=(N + 1, np.sum(v) + 1), fill_value=(N * W), dtype=np.int64)

    dp[:, 0] = 0

    for i in range(N):

        np.minimum(w[i], dp[i][:v[i]], dp[i + 1][:v[i]])

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

    return np.where(dp[-1] <= W)[0][-1]





def main():

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



    w = np.empty(shape=N, dtype=np.int64)

    v = np.empty(shape=N, dtype=np.int64)

    for i in range(N):

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



    ans = solve(N, W, w, v)

    print(ans)





if __name__ == "__main__":

    main()

import sys



# import numba as nb

import numpy as np



input = sys.stdin.readline





# @nb.njit("i8(i8,i8,i8[:],i8[:])")

def solve(N, W, w, v):

    dp = np.full(shape=(N + 1, np.sum(v) + 1), fill_value=(N * W), dtype=np.int64)

    dp[:, 0] = 0

    for i in range(N):

        np.minimum(w[i], dp[i][:v[i]], dp[i + 1][:v[i]])

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

    return np.where(dp[-1] <= W)[0][-1]





def main():

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



    w = np.empty(shape=N, dtype=np.int64)

    v = np.empty(shape=N, dtype=np.int64)

    for i in range(N):

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



    ans = solve(N, W, w, v)

    print(ans)





if __name__ == "__main__":

    main()

import sys
import numba as nb
import numpy as np

input = sys.stdin.readline


@nb.njit("i8(i8,i8,i8[:],i8[:])")
def solve(N, W, w, v):
    dp = np.full(shape=(N + 1, np.sum(v) + 1), fill_value=(N * W), dtype=np.int64)
    dp[:, 0] = 0
    for i in range(N):
        np.minimum(w[i], dp[i][: v[i]], dp[i + 1][: v[i]])
        np.minimum(w[i] + dp[i][: -v[i]], dp[i][v[i] :], dp[i + 1][v[i] :])
    return np.where(dp[-1] <= W)[0][-1]


def main():
    N, W = list(map(int, input().split()))
    w = np.empty(shape=N, dtype=np.int64)
    v = np.empty(shape=N, dtype=np.int64)
    for i in range(N):
        w[i], v[i] = list(map(int, input().split()))
    ans = solve(N, W, w, v)
    print(ans)


if __name__ == "__main__":
    main()

import sys

# import numba as nb
import numpy as np

input = sys.stdin.readline
# @nb.njit("i8(i8,i8,i8[:],i8[:])")
def solve(N, W, w, v):
    dp = np.full(shape=(N + 1, np.sum(v) + 1), fill_value=(N * W), dtype=np.int64)
    dp[:, 0] = 0
    for i in range(N):
        np.minimum(w[i], dp[i][: v[i]], dp[i + 1][: v[i]])
        np.minimum(w[i] + dp[i][: -v[i]], dp[i][v[i] :], dp[i + 1][v[i] :])
    return np.where(dp[-1] <= W)[0][-1]


def main():
    N, W = list(map(int, input().split()))
    w = np.empty(shape=N, dtype=np.int64)
    v = np.empty(shape=N, dtype=np.int64)
    for i in range(N):
        w[i], v[i] = list(map(int, input().split()))
    ans = solve(N, W, w, v)
    print(ans)


if __name__ == "__main__":
    main()

-import numba as nb + +# import numba as nb - - -@nb.njit("i8(i8,i8,i8[:],i8[:])") +# @nb.njit("i8(i8,i8,i8[:],i8[:])")