n, w = io.read("*n", "*n") c = -1 for i = 1, n do a, b = io.read("*n", "*n") if b <= w then c = math.max(c, a) end end print(c)