from sys import stdin, stdout


def solve(mw, iw, iv):
    vs = sum(iv)
    A = [[float('inf') for i in range(vs+1)] for i in range(len(iv) + 1)]        
    A[0][0] = 0
    for i in range(1, len(iv) + 1):
        for j in range(vs + 1):
            if j < iv[i-1]: A[i][j] = A[i-1][j]
            else: A[i][j] = min(A[i-1][j], A[i-1][j-iv[i-1]] + iw[i-1])
    ans = 0
    for i in range(len(A[0])-1, -1, -1):
        if A[-1][i] != float('inf') and A[-1][i] <= mw:
            return i

def test():
    f = open('a.txt', 'r')
    t = int(f.readline())
    count, error = 1, 0
    for _ in range(t):
        try:
            n, mw = f.readline().split()
            iw, iv = [], []
            for _ in range(int(n)):
                w, v = f.readline().split()
                iw.append(int(w))
                iv.append(int(v))
            ans = int(f.readline())
            output = solve(int(mw), iw, iv)
            if ans != output:
                error += 1 
                stdout.write(f"Case #:{count} (WA) | Ans: {ans} Output: {output}\n")
            else:
                stdout.write(f"Case #:{count} Pass\n")
        except RuntimeError:
            error += 1
            stdout.write(f"Case #{count} (RE)")
        count += 1
    if error == 0: stdout.write("All test cases passed")
    else: stdout.write(f"Passed: {count-error-1} | Errors: {error}")

def main():
    iw, iv = [], []
    n, mw = [int(i) for i in stdin.readline().split()]
    for _ in range(n):
        w,v = [int(i) for i in stdin.readline().split()]
        iw.append(w)
        iv.append(v)
    print(solve(mw, iw, iv))

main()


### FIXED CODE ###

from sys import stdin, stdout


def solve(mw, iw, iv):
    vs = sum(iv)
    A = [[float('inf') for i in range(vs+1)] for i in range(len(iv) + 1)]        
    A[0][0] = 0
    rs = 0
    for i in range(1, len(iv) + 1):
        rs += iv[i-1]
        for j in range(vs + 1):
            if i > rs: break
            if j < iv[i-1]: A[i][j] = A[i-1][j]
            else: A[i][j] = min(A[i-1][j], A[i-1][j-iv[i-1]] + iw[i-1])
    ans = 0
    for i in range(len(A[0])-1, -1, -1):
        if A[-1][i] != float('inf') and A[-1][i] <= mw:
            return i

# def test():
#     f = open('a.txt', 'r')
#     t = int(f.readline())
#     count, error = 1, 0
#     for _ in range(t):
#         try:
#             n, mw = f.readline().split()
#             iw, iv = [], []
#             for _ in range(int(n)):
#                 w, v = f.readline().split()
#                 iw.append(int(w))
#                 iv.append(int(v))
#             ans = int(f.readline())
#             output = solve(int(mw), iw, iv)
#             if ans != output:
#                 error += 1 
#                 stdout.write(f"Case #:{count} (WA) | Ans: {ans} Output: {output}\n")
#             else:
#                 stdout.write(f"Case #:{count} Pass\n")
#         except RuntimeError:
#             error += 1
#             stdout.write(f"Case #{count} (RE)")
#         count += 1
#     if error == 0: stdout.write("All test cases passed")
#     else: stdout.write(f"Passed: {count-error-1} | Errors: {error}")

def main():
    iw, iv = [], []
    n, mw = [int(i) for i in stdin.readline().split()]
    for _ in range(n):
        w,v = [int(i) for i in stdin.readline().split()]
        iw.append(w)
        iv.append(v)
    print(solve(mw, iw, iv))

main()
# test()