#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include <bits/stdc++.h>
using namespace std;
#define fast() 				ios_base::sync_with_stdio(false); cin.tie(NULL)
#define tc() 				int t; cin>>t; while(t--)
#define c(n) 				cout<<n<<"\n"
#define in(n) 				int n; cin>>n
#define mem(a, b) 			memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) 	for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) 	for (int i=j ; i>=k ; i-=in)
#define fr(i, n) 			FOR(i, 0, n, 1)
#define rfr(i, n) 			RFOR(i, j, 0, 1)
#define all(cont) 			cont.begin(), cont.end()
#define rall(cont) 			cont.end(), cont.begin()
#define gcd(a,b)  			__gcd(a,b)
#define mp 					make_pair
#define pb 					push_back
#define X 					first
#define Y 					second
#define sz 					size
#define clr 				clear
#define len 				length
#define inf 				(ll)1e9
#define eps 				1e-9
#define pi 					3.1415926535897932384626433832795
#define h 					1000000007
#define gc 					getchar//_unlocked
#define pc 					putchar//_unlocked
const double 				PI=acos(-1.0);
#define pl(a, n) 			for (ll i = 0; i < n; i++) cout << a[i] << ' ' ; br
#define pv(v) 				for (auto itv = v.begin(); itv != v.end(); itv++) cout << *itv << ' ' ; br
#define ps(s) 				for (auto its = s.begin(); its != s.end(); its++) cout << *its << ' '; br
#define pmp(m)		 		for (auto itm = m.begin(); itm != m.end(); itm++) cout << (*itm).ff << ' ' << (*itm).ss << endl;
#define pmm(m) 				for (auto itm = m.begin(); itm != m.end(); itm++) cout << (*itm).ff << ' ' << (*itm).ss << endl;
#define p2(a, b) 			cout << a << ' ' << b; br
#define p3(a, b, c) 		cout << a << ' ' << b << ' ' << c; br
#define p4(a, b, c, d) 		cout << a << ' ' << b << ' ' << c << ' ' << d; br
#define sum(a, n, s) 		ll s = 0; for (ll i = 0; i < n; i++) s += a[i];
#define br 					cout << endl;
#define il(arr,n) 			vll arr(n,0); fr(i,n) {cin>>arr[i];}
typedef long long int 		ll;
typedef long double 		ld;
typedef pair<ll,ll> 		pii;
typedef vector<pii> 		vpii;
typedef vector<ll> 			vll;
typedef vector<int> 		vi;
typedef vector<vi> 			vvi;
typedef map<int,int> 		mii;
typedef set<int> 			seti;
typedef multiset<int> 		mulset;
typedef unsigned long long 	ull;

clock_t time_p=clock();
void amit()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}


#define dbg(...) { cerr<<"[ "; __amit__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.X<<","<<x.Y<<")";
}

template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}

template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}

template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}

template <typename Arg1>
void __amit__(const string name, Arg1&& arg1){
	cerr << name << " : " << arg1 << " ] " << endl;
}

template <typename Arg1, typename... Args>
void __amit__(const string names, Arg1&& arg1, Args&&... args){
	const string name = names.substr(0,names.find(','));
	cerr<<name<<" : "<<arg1<<" | ";
	__amit__(names.substr(1+(int)name.size()), args...);
}


const ll INF = 0xFFFFFFFFFFFFFFFL;

ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF)
{return uniform_int_distribution<ll>(l,r)(rng);}

class CMP
{public:
bool operator()(pii a , pii b) //For min priority_queue .
{    return ! ( a.X < b.X || a.X==b.X && a.Y <= b.Y);   }};

void add( map<ll,ll> &m, ll x,ll cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<ll,ll> &m, ll x,ll cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const pii &a,const pii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const ll mod = 1000000007L;
const ll MXN = 10000L;
//priority_queue < pii , vector < pii > , CMP > pq;// min priority_queue .
//----------------------------------------------------------------------------------------




signed main()
{
	fast();
	// cout<<std::fixed<<std::setprecision(35);
	// since total value we can achieve is less than 10**5 we can dynamically get the minimum weigh to get the desiered value

	in(n); in(W);
	vll w(n+1), v(n+1);
	ll total=0;
	fr(i,n)
	{
		cin>>w[i]>>v[i], total+=v[i];
	}
	// c(total);
	vll dp(total+5,inf+10);
	dp[0]=0;
	for (int i = 0; i <n ; ++i)
	{
		for (int j = total; j >= 0; j--)
		{
			if(j >= v[i])
				dp[j] = min(dp[j-v[i]]+w[i],dp[j]);
		}
	}
	dbg(dp);
	
	ll res=0;
	fr(i,total+1){
		if(dp[i]<=W)
			res=max((int)res,i);
	}
	c(res);
	br;
	amit();
	return 0;
}

Measured memory_bytes: 1024