# ABC061 C - Big Array

from operator import itemgetter

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

A = []

B = []

AB = [[] for _ in range(N)]



for i in range(N):

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

    AB[i].append(a)

    AB[i].append(b)



AB.sort(key=itemgetter(0, 1))



ans = 0

if len(AB) == 1:

    ans = AB[0][0]

    print(ans)

    exit()



for i in range(N):

    if i == 0:

        AB[0].append(AB[0][1])

        continue

    AB[i].append(AB[i-1][2]+AB[i][1])



for i in range(N):

    if i == 0:

       f = 0

       t = AB[0][2]

       if f < K <= t:

           ans = AB[0][0]

           break

       continue

    f = AB[i-1][2]

    t = AB[i][2]

    if f < K <= t:

        ans = AB[i][0]

        break

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

ab=[]

for i in range(n):

  aa,bb=list(map(int,input().split()))

  ab.append([aa,bb])

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

a,b=[],[]

for aa,bb in ab:

  a.append(aa)

  b.append(bb)

from itertools import accumulate

c=list(accumulate(b))

idx=-1

for i in range(n):

  if i==0:

    if 0<=k<=c[i]:

      idx=i

      break

    continue

  if c[i-1]<k<=c[i]:

    idx=i

    break

print((a[idx]))
# ABC061 C - Big Array
from operator import itemgetter

N, K = list(map(int, input().split()))
A = []
B = []
AB = [[] for _ in range(N)]
for i in range(N):
    a, b = list(map(int, input().split()))
    AB[i].append(a)
    AB[i].append(b)
AB.sort(key=itemgetter(0, 1))
ans = 0
if len(AB) == 1:
    ans = AB[0][0]
    print(ans)
    exit()
for i in range(N):
    if i == 0:
        AB[0].append(AB[0][1])
        continue
    AB[i].append(AB[i - 1][2] + AB[i][1])
for i in range(N):
    if i == 0:
        f = 0
        t = AB[0][2]
        if f < K <= t:
            ans = AB[0][0]
            break
        continue
    f = AB[i - 1][2]
    t = AB[i][2]
    if f < K <= t:
        ans = AB[i][0]
        break
print(ans)

n, k = list(map(int, input().split()))
ab = []
for i in range(n):
    aa, bb = list(map(int, input().split()))
    ab.append([aa, bb])
ab.sort(key=lambda x: x[0])
a, b = [], []
for aa, bb in ab:
    a.append(aa)
    b.append(bb)
from itertools import accumulate

c = list(accumulate(b))
idx = -1
for i in range(n):
    if i == 0:
        if 0 <= k <= c[i]:
            idx = i
            break
        continue
    if c[i - 1] < k <= c[i]:
        idx = i
        break
print((a[idx]))

-# ABC061 C - Big Array -from operator import itemgetter +n, k = list(map(int, input().split())) +ab = [] +for i in range(n): +    aa, bb = list(map(int, input().split())) +    ab.append([aa, bb]) +ab.sort(key=lambda x: x[0]) +a, b = [], [] +for aa, bb in ab: +    a.append(aa) +    b.append(bb) +from itertools import accumulate -N, K = list(map(int, input().split())) -A = [] -B = [] -AB = [[] for _ in range(N)] -for i in range(N): -    a, b = list(map(int, input().split())) -    AB[i].append(a) -    AB[i].append(b) -AB.sort(key=itemgetter(0, 1)) -ans = 0 -if len(AB) == 1: -    ans = AB[0][0] -    print(ans) -    exit() -for i in range(N): +c = list(accumulate(b)) +idx = -1 +for i in range(n): -        AB[0].append(AB[0][1]) -        continue -    AB[i].append(AB[i - 1][2] + AB[i][1]) -for i in range(N): -    if i == 0: -        f = 0 -        t = AB[0][2] -        if f < K <= t: -            ans = AB[0][0] +        if 0 <= k <= c[i]: +            idx = i -    f = AB[i - 1][2] -    t = AB[i][2] -    if f < K <= t: -        ans = AB[i][0] +    if c[i - 1] < k <= c[i]: +        idx = i -print(ans) +print((a[idx]))