#include //#include using namespace std; //using namespace atcoder; using ll = long long; //using mint = modint998244353; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int N, W, ans=-1, v, w; cin >> N >> W; for (int i=0; i> v >> w; if (w <= W) ans = max(ans, v); } cout << ans << endl; return 0; }