import numpy as np





def main(n, w, items):

    MAX_VALUE = 100100

    dp = np.ones((n + 1, MAX_VALUE), dtype=int)

    dp = dp * (1 << 30)

    dp[0][0] = 0

    for i in range(0, n):

        weight, value = items[i]

        dp[i + 1][:value] = np.minimum(dp[i][:value], dp[i + 1][:value])

        dp[i + 1][value:] = np.minimum(dp[i][value:], dp[i][:MAX_VALUE - value] + weight)



    result = 0

    for v in range(MAX_VALUE):

        if dp[-1][v] <= w:

            result = v

    return result





if __name__ == '__main__':

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

    I = []

    for _ in range(N):

        I.append(tuple(map(int, input().split())))

    print((main(N, W, I)))

import numpy as np



MAX_VALUE = 100100

INF_WEIGHT = 1 << 30





def main(n, w, items):

    dp = np.full(

        shape=(n + 1, MAX_VALUE),

        fill_value=INF_WEIGHT,

        dtype=int,

    )

    dp[0][0] = 0

    for i in range(0, n):

        weight, value = items[i]

        dp[i + 1][:value] = np.minimum(dp[i][:value], dp[i + 1][:value])

        dp[i + 1][value:] = np.minimum(dp[i][value:], dp[i][:MAX_VALUE - value] + weight)



    return np.max(np.where(dp[-1] <= w))





if __name__ == '__main__':

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

    I = []

    for _ in range(N):

        I.append(tuple(map(int, input().split())))

    print((main(N, W, I)))

import numpy as np


def main(n, w, items):
    MAX_VALUE = 100100
    dp = np.ones((n + 1, MAX_VALUE), dtype=int)
    dp = dp * (1 << 30)
    dp[0][0] = 0
    for i in range(0, n):
        weight, value = items[i]
        dp[i + 1][:value] = np.minimum(dp[i][:value], dp[i + 1][:value])
        dp[i + 1][value:] = np.minimum(
            dp[i][value:], dp[i][: MAX_VALUE - value] + weight
        )
    result = 0
    for v in range(MAX_VALUE):
        if dp[-1][v] <= w:
            result = v
    return result


if __name__ == "__main__":
    N, W = list(map(int, input().split()))
    I = []
    for _ in range(N):
        I.append(tuple(map(int, input().split())))
    print((main(N, W, I)))

import numpy as np

MAX_VALUE = 100100
INF_WEIGHT = 1 << 30


def main(n, w, items):
    dp = np.full(
        shape=(n + 1, MAX_VALUE),
        fill_value=INF_WEIGHT,
        dtype=int,
    )
    dp[0][0] = 0
    for i in range(0, n):
        weight, value = items[i]
        dp[i + 1][:value] = np.minimum(dp[i][:value], dp[i + 1][:value])
        dp[i + 1][value:] = np.minimum(
            dp[i][value:], dp[i][: MAX_VALUE - value] + weight
        )
    return np.max(np.where(dp[-1] <= w))


if __name__ == "__main__":
    N, W = list(map(int, input().split()))
    I = []
    for _ in range(N):
        I.append(tuple(map(int, input().split())))
    print((main(N, W, I)))

+ +MAX_VALUE = 100100 +INF_WEIGHT = 1 << 30 -    MAX_VALUE = 100100 -    dp = np.ones((n + 1, MAX_VALUE), dtype=int) -    dp = dp * (1 << 30) +    dp = np.full( +        shape=(n + 1, MAX_VALUE), +        fill_value=INF_WEIGHT, +        dtype=int, +    ) -    result = 0 -    for v in range(MAX_VALUE): -        if dp[-1][v] <= w: -            result = v -    return result +    return np.max(np.where(dp[-1] <= w))