#include<cstdio>
#include<algorithm>
#define N_ 101000
using namespace std;
long long D[N_];
int a, b, n, W;
int main() {
	int i, j;
	scanf("%d%d", &n,&W);
	for (i = 0; i <= 100000; i++)D[i] = 1e18;
	D[0] = 0;
	for (i = 1; i <= n; i++) {
		scanf("%d%d", &a, &b);
		for (j = 1000 * i; j >= b; j--) {
			D[j] = min(D[j], D[j - b] + a);
		}
	}
	long long r = 0;
	for (i = 0; i <= 100000; i++)if (D[i] <= W)r = i;
	printf("%lld\n", r);
}