import heapq



n, k = list(map(int,input().split()))



q = []

for i in range(n):

    q.append(list(map(int, input().split())))



heapq.heapify(q)



cnt = 0

while cnt < k:

    a, b = heapq.heappop(q)

    cnt += b

    

print(a)
n, k = list(map(int,input().split()))



q = []

for i in range(n):

    q.append(list(map(int, input().split())))



q = sorted(q, key=lambda x:x[0])

cnt = 0

i = 0

while cnt < k:

    a, b = q[i]

    cnt += b

    i += 1

print(a)
import heapq

n, k = list(map(int, input().split()))
q = []
for i in range(n):
    q.append(list(map(int, input().split())))
heapq.heapify(q)
cnt = 0
while cnt < k:
    a, b = heapq.heappop(q)
    cnt += b
print(a)

n, k = list(map(int, input().split()))
q = []
for i in range(n):
    q.append(list(map(int, input().split())))
q = sorted(q, key=lambda x: x[0])
cnt = 0
i = 0
while cnt < k:
    a, b = q[i]
    cnt += b
    i += 1
print(a)

-import heapq - -heapq.heapify(q) +q = sorted(q, key=lambda x: x[0]) +i = 0 -    a, b = heapq.heappop(q) +    a, b = q[i] +    i += 1