#include #ifdef local #include "debug.hpp" #endif using namespace std; int main(void) { ios::sync_with_stdio(false); cin.tie(nullptr); constexpr char endl = '\n'; int n, W; cin >> n >> W; vector v(n), w(n); for (int i = 0; i < n; i++) { cin >> v[i] >> w[i]; } int ans = -1; for (int i = 0; i < n; i++) { if (w[i] <= W) ans = max(ans, v[i]); } cout << ans << endl; return 0; }