n,w = map(int,input().split()) lis = [] for i in range(n): vi,wi = map(int,input().split()) lis.append([vi,wi]) lis.sort(reverse = True) for i,j in lis: if j <= w: print(i) exit() print(-1)