#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(ll key, ll value){
      this->key = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;

void knapsack_search(const ll pos, const ll W, const vll& w, const vll& v, vvll& dp){
  if(pos>=v.size()) return;
  if(pos==v.size()-1){
    for(ll i=0; i<min(w[pos], W+1); ++i){
      dp[pos][i] = 0;
    }
    for(ll i=w[pos]; i<=W; ++i){
      dp[pos][i] = v[pos];
    }
    return;
  }
  knapsack_search(pos+1, W, w, v, dp);
  for(ll i=0; i<min(w[pos], W+1); ++i){
    dp[pos][i] = dp[pos+1][i];
  }
  for(ll i=w[pos]; i<=W; ++i){
    dp[pos][i] = max(dp[pos+1][i-w[pos]] + v[pos], dp[pos+1][i]);
  }

  return;
}

void knapsack_search2(const ll pos, const ll W, const vll& w, const vll& v, vll& dp){
  if(pos>=v.size()) return;
  if(pos==v.size()-1){
    for(ll i=0; i<min(w[pos], W+1); ++i){
      dp[i] = 0;
    }
    for(ll i=w[pos]; i<=W; ++i){
      dp[i] = v[pos];
    }
    return;
  }
  knapsack_search2(pos+1, W, w, v, dp);
  vll dp_copy = dp;
  for(ll i=0; i<min(w[pos], W+1); ++i){
    dp[i] = dp_copy[i];
  }
  for(ll i=w[pos]; i<=W; ++i){
    dp[i] = max(dp_copy[i-w[pos]] + v[pos], dp_copy[i]);
  }

  return;
}

void knapsack_search3(const ll pos, const ll W, const vll& w, const vll& v, vll& dp){
  if(pos>=v.size()) return;
  if(pos==v.size()-1){
    for(ll i=0; i<=v[pos]; ++i){
      dp[i] = w[pos];
    }
    return;
  }
  knapsack_search3(pos+1, W, w, v, dp);
  vll dp_copy = dp;
  for(ll i=0; i<=v[pos]; ++i){
    dp[i] = min(dp_copy[i], w[pos]);
  }
  for(ll i=v[pos]+1; i<dp.size(); ++i){
    dp[i] = min(dp_copy[i-v[pos]] + w[pos], dp_copy[i]);
  }
  return;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, W;
  cin >> N >> W;
  vll w(N), v(N);
  ll v_sum=0;
  rep(i, 0, N){
    cin >> w[i] >> v[i];
    v_sum+=v[i];
  }

  ll ans = v_sum;

  //vvll dp(N, vll(W+1, 0));
  //knapsack_search(0, W, w, v, dp);
  //ans = dp[W];

  //vll dp(W+1, 0);
  //knapsack_search2(0, W, w, v, dp);
  //ans = dp[W];

  vll dp(v_sum+1, 1E+9);
  knapsack_search3(0, W, w, v, dp);
  for(ll i=0; i<=v_sum; ++i){
    if(dp[i]>W) break;
    ans = i;
  }

  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 1792