local mma, mmi = math.max, math.min
local mfl, mce = math.floor, math.ceil
local function comp(a, b)
  return a < b
end
local function upper_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if comp(x, ary[1]) then return 1 end
  if not comp(x, ary[num]) then return num + 1 end
  local min, max = 1, num
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if not comp(x, ary[mid]) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local n, W = io.read("*n", "*n")
local v, w = {}, {}
local low_w = true
for i = 1, n do
  w[i], v[i] = io.read("*n", "*n")
end

local function solve_low_w()
  local t = {}
  for i = 1, W do t[i] = 0 end
  for i = 1, n do
    for j = W - w[i], 1, -1 do
      if 0 < t[j] then
        t[j + w[i]] = mma(t[j + w[i]], t[j] + v[i])
      end
    end
    t[w[i]] = mma(t[w[i]], v[i])
  end
  local ret = 0
  for i = 1, W do ret = mma(ret, t[i]) end
  return ret
end

local function solve_low_v()
  local t = {}
  for i = 1, 200000 do t[i] = 0 end
  local v_cursum = 0
  for i = 1, n do
    local vlim = mmi(v_cursum, 200000 - v[i])
    for j = vlim, 1, -1 do
      if 0 < t[j] then
        if t[j + v[i]] == 0 then
          t[j + v[i]] = t[j] + w[i]
        else
          t[j + v[i]] = mmi(t[j + v[i]], t[j] + w[i])
        end
      end
    end
    if t[v[i]] == 0 then
      t[v[i]] = w[i]
    else
      t[v[i]] = mmi(t[v[i]], w[i])
    end
    v_cursum = v_cursum + v[i]
  end
  local ret = 0
  for i = 200000, 1, -1 do
    if 0 < t[i] and t[i] <= W then ret = i break end
  end
  return ret
end
print(solve_low_w())
