#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int N = 1e5+5;

ll dp[N];

int main()
{
	int n, W;
	cin >> n >> W;
	memset(dp, 0x3f, sizeof dp);
	dp[0] = 0;
	for (int i = 0; i < n; i++)
	{
		int w, v;
		cin >> w >> v;
		for (int j = N-5; j >= v; j--)
			dp[j] = min(dp[j], dp[j-v] + w);
	}
	for (int i = N-5; i >= 0; i--)
	{
		if (dp[i] != inf && dp[i] <= W)
		{
			cout << i;
			return 0;
		}
	}
	return 0;
}