n,w = map(int,input().split()) m = -1 for _ in range(n): a,b = map(int,input().split()) if b <= w: m = max(a,m) print(m)