#include <bits/stdc++.h>

int main()
{
	int N;
	int64_t W;
	scanf("%d%lld", &N, &W);
	using vi = std::vector<int64_t>;
	vi v(N), w(N);
	int64_t sum{};
	for (int i{}; i < N; i++)
	{
		scanf("%lld%lld", &v[i], &w[i]);
		sum += v[i];
	}
	
	vi dp(sum + 1, 1ll << 60);
	dp[0] = 0;
	for (int i{}; i < N; i++)
		for (int64_t j{sum}; j >= v[i]; j--)
			dp[j] = std::min(dp[j], dp[j - v[i]] + w[i]);
	for (int64_t i{sum}; i >= 0; i--)
	{
		if (dp[i] <= W)
		{
			printf("%lld\n", i);
			break;
		}
	}
	return 0;
}
