#include <stdio.h>
#include <algorithm>
using namespace std;

int N, W; long long D[100100];

int main()
{
	scanf("%d %d", &N, &W);

	for (int j=1;j<=100000;j++) D[j] = 1e16;
	for (int i=1;i<=N;i++){
		int w,v; scanf ("%d %d",&w,&v);
		for (int j=100000-v;j>=0;j--) if (D[j+v] > D[j] + w) D[j+v] = D[j] + w;
	}
	for (int i=100000;i>=0;i--) if (D[i] <= W){
		printf ("%d\n",i);
		break;
	}

	return 0;
}
