from collections import Counter

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



c = Counter()

for _ in range(n):

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

    c[a] += b

c = sorted(list(c.items()), key=lambda x: x[0])



for i, v in c:

    k -= v

    if k <= 0:

        print(i)

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



bucket = [0] * (10 ** 5 + 1)

for _ in range(N):

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

    bucket[a] += b



cnt = 0

for i, c in enumerate(bucket):

    if c == 0:

        continue

    cnt += c

    if cnt >= K:

        print(i)

        exit()
from collections import Counter

n, k = list(map(int, input().split()))
c = Counter()
for _ in range(n):
    a, b = list(map(int, input().split()))
    c[a] += b
c = sorted(list(c.items()), key=lambda x: x[0])
for i, v in c:
    k -= v
    if k <= 0:
        print(i)
        exit()

N, K = list(map(int, input().split()))
bucket = [0] * (10**5 + 1)
for _ in range(N):
    a, b = list(map(int, input().split()))
    bucket[a] += b
cnt = 0
for i, c in enumerate(bucket):
    if c == 0:
        continue
    cnt += c
    if cnt >= K:
        print(i)
        exit()

-from collections import Counter - -n, k = list(map(int, input().split())) -c = Counter() -for _ in range(n): +N, K = list(map(int, input().split())) +bucket = [0] * (10**5 + 1) +for _ in range(N): -    c[a] += b -c = sorted(list(c.items()), key=lambda x: x[0]) -for i, v in c: -    k -= v -    if k <= 0: +    bucket[a] += b +cnt = 0 +for i, c in enumerate(bucket): +    if c == 0: +        continue +    cnt += c +    if cnt >= K: