#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, W;
  cin >> N >> W;
  vector<long> DP(N * 1e3 + 1, 2e18);
  DP.at(0) = 0;
  for (int w, v; cin >> w >> v;) {
    vector<long> tmp = DP;
    for (int i = v; i < tmp.size(); i++) {
      tmp.at(i) = min(tmp.at(i), DP.at(i - v) + w);
    }
    DP = tmp;
  }
  long ans = 0;
  for (int i = 0; i < DP.size(); i++) {
    if (DP.at(i) <= W) ans = max(ans, (long) i);
  }
  cout << ans << "\n";
}