import std; void main () { int N, W; readln.read(N, W); int[] v = new int[](N); int[] w = new int[](N); foreach (i; 0..N) { readln.read(v[i], w[i]); } int ans = -1; foreach (i; 0..N) { if (w[i] <= W && ans < v[i]) { ans = v[i]; } } writeln(ans); } void read(T...)(string S, ref T args) { auto buf = S.split; foreach (i, ref arg; args) { arg = buf[i].to!(typeof(arg)); } }