n, w = map(int, input().split()) V = [0] * n W = [0] * n for i in range(n): V[i], W[i] = map(int, input().split()) maxw = 0 ans = -1 for i in range(n): if W[i] <= w: maxw = W[i] ans = V[i] print(ans)