import bisect



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

A = []; B = [0]



for i in range(N):

    a, b = list(map(int, input().split()))

    A.append([a, b])

A.sort()

for i in range(N):

    B.append(A[i][1] + B[i])



ans = bisect.bisect_left(B, K) - 1

print((A[ans][0]))
N, K = list(map(int, input().split()))

cnt = [0 for _ in range(10**5 + 10)]



for i in range(N):

    a, b = list(map(int, input().split()))

    cnt[a] += b



res = 0

for i in range(len(cnt)):

    res += cnt[i]

    if res >= K:

        break

print(i)
import bisect

N, K = list(map(int, input().split()))
A = []
B = [0]
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append([a, b])
A.sort()
for i in range(N):
    B.append(A[i][1] + B[i])
ans = bisect.bisect_left(B, K) - 1
print((A[ans][0]))

N, K = list(map(int, input().split()))
cnt = [0 for _ in range(10**5 + 10)]
for i in range(N):
    a, b = list(map(int, input().split()))
    cnt[a] += b
res = 0
for i in range(len(cnt)):
    res += cnt[i]
    if res >= K:
        break
print(i)

-import bisect - -A = [] -B = [0] +cnt = [0 for _ in range(10**5 + 10)] -    A.append([a, b]) -A.sort() -for i in range(N): -    B.append(A[i][1] + B[i]) -ans = bisect.bisect_left(B, K) - 1 -print((A[ans][0])) +    cnt[a] += b +res = 0 +for i in range(len(cnt)): +    res += cnt[i] +    if res >= K: +        break +print(i)