import sys

import pdb

input = sys.stdin.readline



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

ws = [0]

vs = [0]



for _ in range(N):

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

  ws.append(w)

  vs.append(v)



inf = 2e11

V = int(sum(vs))   # N * max(vs)

# V = int(100 * 1e3)   # N * max(vs)

# Weight[i番目までの品番][価値j]

Weight = [[inf for _ in range(V+1)] for __ in range(N+1)]



if ws[1] <= W:

  Weight[1][vs[1]] = ws[1]

  value_max = vs[1]

else:

  value_max = 0



for _ in range(N+1):

  Weight[_][0] = 0



# pdb.set_trace()



for num in range(2, N+1):

  for value in range(1, V+1):

    if value >= vs[num]:   # 新しい品物を入れられるとき

      Weight[num][value] = min(Weight[num][value], Weight[num-1][value], Weight[num-1][value-vs[num]] + ws[num])

      if Weight[num][value] <= W:

        value_max = max(value_max, value)

      else:

        Weight[num][value] = inf

    else:   # 新しい品物を入れられないとき

      # 重さを変えることはできない

      Weight[num][value] = Weight[num-1][value]

      # Weight[num][value] = max(Weight[num][value], Weight[num-1][value])



# print(Weight)

print(value_max)

import sys

import pdb

input = sys.stdin.readline



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

ws = [0]

vs = [0]



for _ in range(N):

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

  ws.append(w)

  vs.append(v)



inf = sum(ws)+1

V = int(sum(vs))   # N * max(vs)

# V = int(100 * 1e3)   # N * max(vs)

# Weight[i番目までの品番][価値j]

Weight = [[inf for _ in range(V+1)] for __ in range(N+1)]



if ws[1] <= W:

  Weight[1][vs[1]] = ws[1]

  value_max = vs[1]

else:

  value_max = 0



for _ in range(N+1):

  Weight[_][0] = 0



# pdb.set_trace()



for num in range(2, N+1):

  for value in range(1, V+1):

    if value >= vs[num]:   # 新しい品物を入れられるとき

      Weight[num][value] = min(Weight[num][value], Weight[num-1][value], Weight[num-1][value-vs[num]] + ws[num])

      if Weight[num][value] <= W:

        value_max = max(value_max, value)

      else:

        Weight[num][value] = inf

    else:   # 新しい品物を入れられないとき

      # 重さを変えることはできない

      Weight[num][value] = Weight[num-1][value]

      # Weight[num][value] = max(Weight[num][value], Weight[num-1][value])



# print(Weight)

print(value_max)

import sys
import pdb

input = sys.stdin.readline
N, W = list(map(int, input().split()))
ws = [0]
vs = [0]
for _ in range(N):
    w, v = list(map(int, input().split()))
    ws.append(w)
    vs.append(v)
inf = 2e11
V = int(sum(vs))  # N * max(vs)
# V = int(100 * 1e3)   # N * max(vs)
# Weight[i番目までの品番][価値j]
Weight = [[inf for _ in range(V + 1)] for __ in range(N + 1)]
if ws[1] <= W:
    Weight[1][vs[1]] = ws[1]
    value_max = vs[1]
else:
    value_max = 0
for _ in range(N + 1):
    Weight[_][0] = 0
# pdb.set_trace()
for num in range(2, N + 1):
    for value in range(1, V + 1):
        if value >= vs[num]:  # 新しい品物を入れられるとき
            Weight[num][value] = min(
                Weight[num][value],
                Weight[num - 1][value],
                Weight[num - 1][value - vs[num]] + ws[num],
            )
            if Weight[num][value] <= W:
                value_max = max(value_max, value)
            else:
                Weight[num][value] = inf
        else:  # 新しい品物を入れられないとき
            # 重さを変えることはできない
            Weight[num][value] = Weight[num - 1][value]
            # Weight[num][value] = max(Weight[num][value], Weight[num-1][value])
# print(Weight)
print(value_max)

import sys
import pdb

input = sys.stdin.readline
N, W = list(map(int, input().split()))
ws = [0]
vs = [0]
for _ in range(N):
    w, v = list(map(int, input().split()))
    ws.append(w)
    vs.append(v)
inf = sum(ws) + 1
V = int(sum(vs))  # N * max(vs)
# V = int(100 * 1e3)   # N * max(vs)
# Weight[i番目までの品番][価値j]
Weight = [[inf for _ in range(V + 1)] for __ in range(N + 1)]
if ws[1] <= W:
    Weight[1][vs[1]] = ws[1]
    value_max = vs[1]
else:
    value_max = 0
for _ in range(N + 1):
    Weight[_][0] = 0
# pdb.set_trace()
for num in range(2, N + 1):
    for value in range(1, V + 1):
        if value >= vs[num]:  # 新しい品物を入れられるとき
            Weight[num][value] = min(
                Weight[num][value],
                Weight[num - 1][value],
                Weight[num - 1][value - vs[num]] + ws[num],
            )
            if Weight[num][value] <= W:
                value_max = max(value_max, value)
            else:
                Weight[num][value] = inf
        else:  # 新しい品物を入れられないとき
            # 重さを変えることはできない
            Weight[num][value] = Weight[num - 1][value]
            # Weight[num][value] = max(Weight[num][value], Weight[num-1][value])
# print(Weight)
print(value_max)

-inf = 2e11 +inf = sum(ws) + 1