import sys

input = sys.stdin.readline



N, W = [int(i) for i in input().split()]



def ans(N, W):

    d = [float("inf")] * (N * 1000 + 1)

    d[0] = 0

    V = 0



    for i in range(N):

        wi, vi = [int(i) for i in input().split()]

        V = V + vi



        for v in range(V, vi-1, -1):

            w_ = d[v - vi] + wi

            if w_ < d[v]:

                d[v] = w_



    for v in range(V, -1, -1):

        if d[v] <= W:

            return v



print((ans(N, W)))
import sys

input = sys.stdin.readline



N, W = [int(i) for i in input().split()]



def ans(N, W):

    d = [W+1] * (N * 1000 + 1)

    d[0] = 0

    V = 0



    for i in range(N):

        wi, vi = [int(i) for i in input().split()]

        V = V + vi



        for v in range(V, vi-1, -1):

            w_ = d[v - vi] + wi

            if w_ < d[v]:

                d[v] = w_



    for v in range(V, -1, -1):

        if d[v] <= W:

            return v



print((ans(N, W)))
import sys

input = sys.stdin.readline
N, W = [int(i) for i in input().split()]


def ans(N, W):
    d = [float("inf")] * (N * 1000 + 1)
    d[0] = 0
    V = 0
    for i in range(N):
        wi, vi = [int(i) for i in input().split()]
        V = V + vi
        for v in range(V, vi - 1, -1):
            w_ = d[v - vi] + wi
            if w_ < d[v]:
                d[v] = w_
    for v in range(V, -1, -1):
        if d[v] <= W:
            return v


print((ans(N, W)))

import sys

input = sys.stdin.readline
N, W = [int(i) for i in input().split()]


def ans(N, W):
    d = [W + 1] * (N * 1000 + 1)
    d[0] = 0
    V = 0
    for i in range(N):
        wi, vi = [int(i) for i in input().split()]
        V = V + vi
        for v in range(V, vi - 1, -1):
            w_ = d[v - vi] + wi
            if w_ < d[v]:
                d[v] = w_
    for v in range(V, -1, -1):
        if d[v] <= W:
            return v


print((ans(N, W)))

-    d = [float("inf")] * (N * 1000 + 1) +    d = [W + 1] * (N * 1000 + 1)