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(' ')) m = -1 for M,N in zip(v,w): m = M if (N<=W and m