import std.stdio;
import std.algorithm;

void chmin(T)(ref T a, T b) {
	if (b < a) {
		a = b;
	}
}

void main() {
	enum Inf = long.max / 2;

	long n, capacity;
	readf(" %s %s", &n, &capacity);

	auto weights = new long[n];
	auto values = new long[n];
	long sumValue = 0;

	foreach (i;0..n) {
		readf(" %s %s", &weights[i], &values[i]);
		sumValue += values[i];
	}

	auto dp = new long[sumValue + 1];
	dp[1..$] = Inf;

	foreach (i;0..n) {
		foreach_reverse (v;0..sumValue + 1) {
			if (dp[v] == Inf) {
				continue;
			}

			if (v + values[i] < dp.length) {
				chmin(dp[v + values[i]], dp[v] + weights[i]);
			}
		}
	}

	foreach_reverse (size_t i, e;dp) {
		if (e <= capacity) {
			writeln(i);
			break;
		}
	}
}
