#include using namespace std; #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx2") using ll = long long; using ar2 = array; using ar3 = array; using ar4 = array; #define all(c) (c).begin(), (c).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x).size() #define f0(e) for(int i = 0; i < (e); ++i) #define f1(e) for(int i = 1; i <= (e); ++i) #define f2(i,e) for(int i = 0; i < (e); ++i) #define f3(i,a,b) for (int i=(a);i<(b);i++) #define r3(i,b,a) for (int i=(b)-1;i>=(a);i--) #define Sm(a) accumulate((a).begin(), (a).end() , 0ll) #define Mn(a) (*min_element((a).begin(), (a).end())) #define Mx(a) (*max_element((a).begin(), (a).end())) #define rev(a) reverse((a).begin(), (a).end()) #define each(x,a) for(auto& x : a) #define mst(a,x) memset(a, x, sizeof(a)) mt19937 mrand(random_device{}()); int rng(int x) { return mrand() % x;} int pct(long long x) {return __builtin_popcountll(x);} int lg(int x) {return x == 0 ? -1 : 31 - __builtin_clz(x);} int clg(int x) {return x <= 1 ? 0 : 32 - __builtin_clz(x - 1);} template bool cmx(t &a, const u &b){return a < b ? a = b, 1 : 0;} template bool cmn(t &a, const u &b){return b < a ? a = b, 1 : 0;} template int lb(const vector &v, const T &x) { return distance(begin(v), lower_bound(begin(v), end(v), x));} template int rb(const vector &v, const T &x) { return distance(begin(v), upper_bound(begin(v), end(v), x));} template void psum(vector& s, const vector&a){ int n=a.size();s.resize(n+1);s[0]=0;for(int i=0;i T b_search(T l, T r, bool fst, F &&f) { T c = fst ? r : l; while(l<=r){T md=(l+r)/2;if(f(md)){c=md;fst?(r=md-1):(l=md+1);} else fst?(l=md+1):(r=md-1);} return c; } template // pair ostream& operator<<(ostream& out, const pair& a) {return out << a.first << ' ' << a.second;} template // vector ostream& operator<<(ostream& out, const vector& a) {for(int i=0,n=a.size(); i // array ostream& operator<<(ostream& out, const array& a) {for(int i=0;i // pair istream& operator>>(istream& in, pair& a) {return in >> a.first >> a.second;} template // vector istream& operator>>(istream& in, vector& a) {for (auto &x: a) in >> x; return in;} template // array istream& operator>>(istream& in, array& a) {for (int i=0;i> a[i]; return in;} template void rd(T& x) {cin >> x;} template void rd(H& h, T&... t) {rd(h); rd(t...);} template void wt(A x) { cout << x;} template void wt(const H& h, const T&... t) { wt(h); wt(t...);} template void dbg(A x) { cout< void dbg(const H& h, const T&... t) { dbg(h); dbg(t...);} template void dbg(vector>& x) {each(c,x)wt(c);} struct fast_ios { fast_ios(){ cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(10);}; } fast_ios_; const char nl = '\n'; const int N = 2e5 + 5; int n, m, q; int x, y, k; string s, t; void ac_yyf(int tt) { rd(n,m); vector a(n),w(n); for (int i = 0; i < n; ++i) { cin >> a[i] >> w[i]; } int c = -1; for (int i = 0; i < n; ++i) { if (w[i] <= m) cmx(c, a[i]); } cout << c << '\n'; } int main() { int T = 1; // cin >> T; for (int cas = 1; cas <= T; ++cas) { ac_yyf(cas); // cout << ( ac_yyf(cas) ? "Yes" : "No") << '\n'; // cout << ( ac_yyf(cas) ? "YES" : "NO") << '\n'; } return 0; }