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

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

for i in range(n):

    ai,bi = list(map(int,input().split()))

    l[ai]+=bi

for index,i in enumerate(l):

    if i:

        k-=i

        if k<=0:

            break

print(index)
from collections import defaultdict

from sys import stdin

input = stdin.readline

d = defaultdict(int)

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

for _ in range(n):

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

    d[a]+=b

for key in sorted(d.keys()):

    v = d[key]

    k-=v

    if k <= 0:

        break

print(key)
n, k = list(map(int, input().split()))
l = [0] * (10**5 + 1)
for i in range(n):
    ai, bi = list(map(int, input().split()))
    l[ai] += bi
for index, i in enumerate(l):
    if i:
        k -= i
        if k <= 0:
            break
print(index)

from collections import defaultdict
from sys import stdin

input = stdin.readline
d = defaultdict(int)
n, k = list(map(int, input().split()))
for _ in range(n):
    a, b = list(map(int, input().split()))
    d[a] += b
for key in sorted(d.keys()):
    v = d[key]
    k -= v
    if k <= 0:
        break
print(key)

+from collections import defaultdict +from sys import stdin + +input = stdin.readline +d = defaultdict(int) -l = [0] * (10**5 + 1) -for i in range(n): -    ai, bi = list(map(int, input().split())) -    l[ai] += bi -for index, i in enumerate(l): -    if i: -        k -= i -        if k <= 0: -            break -print(index) +for _ in range(n): +    a, b = list(map(int, input().split())) +    d[a] += b +for key in sorted(d.keys()): +    v = d[key] +    k -= v +    if k <= 0: +        break +print(key)