N, K = list(map(int, input().split()))

ab = [list(map(int, input().split())) for i in range(N)]

ab.sort()



counter = 0

array1 = []



for i in range(N):

  counter += ab[i][1]

  if K <= counter:

    ans = ab[i][0]

    break



print(ans)
N, K = list(map(int, input().split()))

array = [list(map(int, input().split())) for i in range(N)]

array.sort(key=lambda x:x[0])

i,j = 0,0

while i < K:

  i += array[j][1]

  j += 1

print((array[j-1][0]))

N, K = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(N)]
ab.sort()
counter = 0
array1 = []
for i in range(N):
    counter += ab[i][1]
    if K <= counter:
        ans = ab[i][0]
        break
print(ans)

N, K = list(map(int, input().split()))
array = [list(map(int, input().split())) for i in range(N)]
array.sort(key=lambda x: x[0])
i, j = 0, 0
while i < K:
    i += array[j][1]
    j += 1
print((array[j - 1][0]))

-ab = [list(map(int, input().split())) for i in range(N)] -ab.sort() -counter = 0 -array1 = [] -for i in range(N): -    counter += ab[i][1] -    if K <= counter: -        ans = ab[i][0] -        break -print(ans) +array = [list(map(int, input().split())) for i in range(N)] +array.sort(key=lambda x: x[0]) +i, j = 0, 0 +while i < K: +    i += array[j][1] +    j += 1 +print((array[j - 1][0]))