from collections import defaultdict

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

dic = defaultdict(int)

for i in range(n):

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

    dic[a] += b



t = sorted(dic.keys())

for i in t:

    k -= dic[i]

    if k <= 0:

        print(i)

        break
n, K = list(map(int, input().split()))

rec = [0] * (10 ** 5 + 5)

for i in range(n):

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

    rec[a] += b



for i in range(10 ** 5 + 1):

    if rec[i] > 0:

        K -= rec[i]

        if K <= 0:

            print(i)

            exit()
from collections import defaultdict

n, k = list(map(int, input().split()))
dic = defaultdict(int)
for i in range(n):
    a, b = list(map(int, input().split()))
    dic[a] += b
t = sorted(dic.keys())
for i in t:
    k -= dic[i]
    if k <= 0:
        print(i)
        break

n, K = list(map(int, input().split()))
rec = [0] * (10**5 + 5)
for i in range(n):
    a, b = list(map(int, input().split()))
    rec[a] += b
for i in range(10**5 + 1):
    if rec[i] > 0:
        K -= rec[i]
        if K <= 0:
            print(i)
            exit()

-from collections import defaultdict - -n, k = list(map(int, input().split())) -dic = defaultdict(int) +n, K = list(map(int, input().split())) +rec = [0] * (10**5 + 5) -    dic[a] += b -t = sorted(dic.keys()) -for i in t: -    k -= dic[i] -    if k <= 0: -        print(i) -        break +    rec[a] += b +for i in range(10**5 + 1): +    if rec[i] > 0: +        K -= rec[i] +        if K <= 0: +            print(i) +            exit()