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