#include <bits/stdc++.h>
const int64_t INF = 1e18;
signed main() {
std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
int n, W;
std::cin >> n >> W;
std::vector<int> w(n + 1);
std::vector<int> v(n + 1);
for (int i = 1; i <= n; i++) {
std::cin >> w[i] >> v[i];
}
int MAX = *std::max_element(v.begin() + 1, v.end()) * n;
std::vector<int64_t> dp(MAX + 1, INF);
dp[0] = 0;
for (int i = 1; i <= n; i++) {
for (int j = MAX; j >= v[i]; j--) {
if (dp[j - v[i]] == INF) continue;
dp[j] = std::min(dp[j], dp[j - v[i]] + w[i]);
}
}
for (int i = MAX; i >= 0; i--) {
if (dp[i] <= W) {
std::cout << i;
break;
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgpjb25zdCBpbnQ2NF90IElORiA9IDFlMTg7CgpzaWduZWQgbWFpbigpIHsKICAgIHN0ZDo6aW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7IHN0ZDo6Y2luLnRpZShOVUxMKTsKCiAgICBpbnQgbiwgVzsKICAgIHN0ZDo6Y2luID4+IG4gPj4gVzsKCiAgICBzdGQ6OnZlY3RvcjxpbnQ+IHcobiArIDEpOwogICAgc3RkOjp2ZWN0b3I8aW50PiB2KG4gKyAxKTsKCiAgICBmb3IgKGludCBpID0gMTsgaSA8PSBuOyBpKyspIHsKICAgICAgICBzdGQ6OmNpbiA+PiB3W2ldID4+IHZbaV07CiAgICB9CgogICAgaW50IE1BWCA9ICpzdGQ6Om1heF9lbGVtZW50KHYuYmVnaW4oKSArIDEsIHYuZW5kKCkpICogbjsKICAgIHN0ZDo6dmVjdG9yPGludDY0X3Q+IGRwKE1BWCArIDEsIElORik7CiAgICBkcFswXSA9IDA7CgogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKSB7CiAgICAgICAgZm9yIChpbnQgaiA9IE1BWDsgaiA+PSB2W2ldOyBqLS0pIHsKICAgICAgICAgICAgaWYgKGRwW2ogLSB2W2ldXSA9PSBJTkYpIGNvbnRpbnVlOwogICAgICAgICAgICBkcFtqXSA9IHN0ZDo6bWluKGRwW2pdLCBkcFtqIC0gdltpXV0gKyB3W2ldKTsKICAgICAgICB9CiAgICB9CgogICAgZm9yIChpbnQgaSA9IE1BWDsgaSA+PSAwOyBpLS0pIHsKICAgICAgICBpZiAoZHBbaV0gPD0gVykgewogICAgICAgICAgICBzdGQ6OmNvdXQgPDwgaTsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgfQogICAgfSAKCiAgICByZXR1cm4gMDsKfQo=