let input = readLine()!.split(separator: " ").map { Int($0)! }

let N = input[0]
let W = input[1]

var weights: [Int] = .init(repeating: 0, count: N)
var values: [Int] = .init(repeating: 0, count: N)

for i in 0..<N {
  let inp = readLine()!.split(separator: " ").map { Int($0)! }
  weights[i] = inp[0]
  values[i] = inp[1]
}

let V = values.reduce(0, +)

var dp: [[Int]] = .init(repeating: .init(repeating: .max, count: V + 1), count: N + 1)
dp[0][0] = 0
for i in 1...N {
  for j in 0...V {
   	let prev = j - values[i - 1]
    if prev < 0 || dp[i-1][prev] == .max {
      dp[i][j] = dp[i-1][j]
      continue
    }
    dp[i][j] = min(dp[i-1][prev] + weights[i - 1], dp[i-1][j])
  }
}
for j in (0..<dp[N].count).reversed() {
  if dp[N][j] <= W {
    print(j)
    break
  }
}