#include #include #include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); uint32_t N, W, i; cin >> N >> W; vector v(N), w(N); for (i = 0; i != N; ++i) cin >> v[i] >> w[i]; uint32_t ans = 0; for (i = 0; i != N; ++i) if (w[i] <= W && ans < v[i]) ans = v[i]; if (ans == 0) cout << "-1\n"; else cout << ans << '\n'; return 0; }