CodeEff/ECCO huggingface dataset:
# Original solution
N,K = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(N)]
l = []
for a,b in AB:
  ab = [a]*b
  l.extend(ab)

l.sort()
print((l[K-1]))

# Optimized solution
N,K = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(N)]
count = 0
AB.sort()
for a,b in AB:
  count += b
  if count >= K:
    print(a)
    exit()
# Original solution
ans = []
n,k = list(map(int, input().split()))
for i in range(n):
  a, b = list(map(int, input().split()))  
  ans.extend([a for _ in range(b)])
ans.sort()
print((ans[k-1]))

# Optimized solution
from collections import defaultdict
ans = defaultdict(int)
n,k = list(map(int, input().split()))

for i in range(n):
  a, b = list(map(int, input().split()))
  ans[a] += b

ord = 0
for key in sorted(ans.keys()):
  ord += ans[key]
  if(ord >= k):
    print(key)
    exit()
# Original solution

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

l = []

for i in range(N):
    a, b = list(map(int, input().split()))
    l += [a] * b

print((sorted(l)[K-1]))

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

l = []

for i in range(N):
    a, b = list(map(int, input().split()))
    l.append((a,b))
def c(x):
    return  x[0]
l = sorted(l, key=c)
t = 0
for a,b in l:
    t2 = t
    t += b
    if t2 <= K and t >= K:
        break

print(a)
# Original solution
[n,k]=list(map(int,input().split()))
ablist=[]
suretu=[]
for i in range(n):
    ab=list(map(int,input().split()))
    suretu+=[ab[0]]*ab[1]
suretu=sorted(suretu)
print((suretu[k-1]))

# Optimized solution
[n,k]=list(map(int,input().split()))
ablist=[]
for i in range(n):
    ablist.append(list(map(int,input().split())))
ablist=sorted(ablist,key=lambda x:x[0])
bwa=[0]
for i in range(n):
    bwa.append(bwa[-1]+ablist[i][1])
ind=1
while True:
    if bwa[ind-1]<k<=bwa[ind]:
        break
    ind+=1
print((ablist[ind-1][0]))
# Original solution
N, K = list(map(int, input().split()))
array = []
for i in range(N):
    a, b = list(map(int, input().split()))
    array += [a]*b
array.sort()
print((array[K-1]))


# Optimized solution
N, K = list(map(int, input().split()))
abn = [list(map(int, input().split())) for _ in range(N)]
abn.sort()
pool = 0
for ab in abn:
    pool += ab[1]
    if pool >= K:
        print((ab[0]))
        break
# Original solution
#!/usr/bin/python3
# abc061_c
"""
Big Array
"""

test = False

def answer():
    """
    答えを出力する関数
    """
    l_1 = []
    l_2 = []
    N, K = list(map(int, input().split()))

    for _ in range(N):
        l_1.append(list(map(int, input().split())))


    l_1.sort()
    if test:
        print(l_1)

    for v in l_1:
        l_2.extend([v[0]] * v[1])

    # 小さい順にソートして、K-1番目の要素を出力
    if test:
        print(l_2)
    print((l_2[K-1]))


def main():
    """
    処理を実行する関数
    """
    answer()


if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/python3
# abc061_c
"""
Big Array
"""

def answer():
    """
    答えを出力する関数
    """
    l = []
    N, K = list(map(int, input().split()))
    counter = 0

    for _ in range(N):
        l.append(list(map(int, input().split())))

    l.sort()
    for v in l:
        counter += v[1]
        if counter >= K:
            print((v[0]))
            break

def main():
    """
    処理を実行する関数
    """
    answer()


if __name__ == '__main__':
    main()
# Original solution
nums = [int(x) for x in input().split()]
N = nums[0]
K = nums[1]
arr = []
for i in range(N):
	nums = [int(x) for x in input().split()]
	for j in range(nums[1]):
		arr.append(nums[0])
arr.sort()
print((arr[K-1]))

# Optimized solution
nums = [int(x) for x in input().split()]
N = nums[0]
K = nums[1]
arr = []
for i in range(N):
	nums = [int(x) for x in input().split()]
	arr.append(tuple(nums))

arr = sorted(arr, key=lambda x: x[0])

vol = 0
for i in range(len(arr)):
	vol = vol + arr[i][1]
	if vol >= K:
		print((arr[i][0]))
		break
# Original solution
def C(_mid):
    if _mid <= target_list[K - 1]:
        return True
    else:
        return False


N, K = list(map(int, input().split()))
target_list = []
ab = []
for i in range(N):
    a, b = list(map(int, input().split()))
    ab.append([a, b])

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

for i in range(N):
    for j in range(ab[i][1]):
        target_list.append(ab[i][0])

# print(target_list)

lb = 1
ub = 100000
while ub - lb > 1:
    # print(str(lb) + " " + str(ub))
    mid = int((lb + ub) / 2)
    if C(mid):
        lb = mid
    else:
        ub = mid

print(lb)


# Optimized solution
def C(_mid):
    tmp_sum = 0
    if len(ab) <= _mid:
        return False
    for i in range(0, _mid):
        tmp_sum += ab[i][1]
    if tmp_sum < K:
        return True
    else:
        return False


N, K = list(map(int, input().split()))
ab = []
for i in range(N):
    a, b = list(map(int, input().split()))
    ab.append([a, b])

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

lb = 0
ub = 100000
while ub - lb > 1:
    # print(str(lb) + " " + str(ub))
    mid = int((lb + ub) / 2)
    if C(mid):
        lb = mid
    else:
        ub = mid

print((ab[lb][0]))
# Original solution
N, K = list(map(int,input().split()))
l = list()

for n in range(N):
    listA=list(map(int,input().split()))
    for i in range(listA[1]):
        l.append(int(listA[0]))

print((sorted(l)[K-1]))

# Optimized solution
N, K = list(map(int,input().split()))
l = list()

c = 0
ans = 0
ab_list = list()

for n in range(N):
    a,b =list(map(int,input().split()))
    ab_list.append([a,b])

ab_list = sorted(ab_list, key=lambda x: x[0])

for a,b in ab_list:
    c += b
    if c >= K:
        ans = a    
        break

print(ans)
# Original solution
N, K = list(map(int, input().split()))
array = []

for i in range(N):
  a, b = list(map(int, input().split()))
  array.extend([a]*b)
                
array.sort()

print((array[K- 1]))

# Optimized solution
N, K = list(map(int, input().split()))
array = [0]*(10**5+ 1)

for i in range(N):
  a, b = list(map(int, input().split()))
  array[a]+= b
  
S = 0
i = 0

while S < K:
  S+= array[i]
  i+= 1
  
print((i- 1))
# Original solution
def main2():
    n,k = list(map(int,input().split(" ")))
    q = []
    for i in range(n):
        a,b = list(map(int,input().split(" ")))
        q+=[a for j in range(b)]
    
    q.sort()
    print((q[k-1]))

main2()

# Optimized solution

def main2():
    import heapq
    n,k = list(map(int,input().split(" ")))
    q = []
    for i in range(n):
        a,b = list(map(int,input().split(" ")))
        heapq.heappush(q,(a,b))
    
    while k>0:
        a,b = heapq.heappop(q)
        k-=b
    
    print(a)
main2()
# Original solution
n,k=list(map(int,input().split()))
lst=sorted([list(map(int,input().split())) for _ in range(n)])

cnt=0
sm=0
for i in range(n):
    if sm<k:
        cnt+=1
    sm+=lst[i][1]
print((lst[cnt-1][0]))

# Optimized solution
n,m=list(map(int,input().split()))
cnt=0
lst=sorted([list(map(int,input().split())) for _ in range(n)])
#print(lst)
i=0
while cnt<m:
    cnt+=lst[i][1]
    if cnt<m:
        i+=1
print((lst[i][0]))
# Original solution
N,K = list(map(int,input().split()))
AB =[]
for n in range(N):
    a,b = list(map(int,input().split()))
    AB.extend([a]*b)
print((sorted(AB)[K-1]))

# Optimized solution
N,K = list(map(int,input().split()))
AB =[]
for n in range(N):
    a,b = list(map(int,input().split()))
    AB.append([a,b])
AB.sort(key=lambda x:x[0])
cnt = 0
for i,a in enumerate(AB):
    if cnt < K:
        cnt +=a[1]
    if cnt >=K:
        print((a[0]))
        exit()
# Original solution
n, k = list(map(int, input().split()))
AB = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x:x[0])

for a, b in AB:
    k -= b
    if k <= 0:
        print(a)
        break

# Optimized solution
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, k = list(map(int, input().split()))
    AB = [list(map(int, input().split())) for _ in range(n)]
    AB = sorted(AB, key=lambda x: x[0])

    for i in range(n):
        a, b = AB[i]
        if b < k:
            k -= b
        else:
            print(a)
            break


if __name__ == '__main__':
    resolve()
# Original solution
N, K = list(map(int, input().split()))
a_b = [list(input().split()) for i in range(N)]
big_array = []

for i in range(N):
    big_array += [a_b[i][0]] * int(a_b[i][1])

print((sorted(big_array)[K-1]))


# Optimized solution
N, K = list(map(int, input().split()))
a_b = [list(map(int, input().split())) for i in range(N)]
a_b.sort()
index = 0

for i in range(N):
    index += a_b[i][1]
    if index >= K:
        print((a_b[i][0]))
        exit()
# Original solution
n, k = list(map(int, input().split()))
array = []
for i in range(n):
   a, b = list(map(int, input().split()))
   array.extend([a for _ in range(b)])

array.sort()
print((array[k-1]))


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

x = [0 for _ in range(0, 100001)]

for i in range(n):
   a, b = list(map(int, input().split()))
   x[a] += b

l = 0
for i in range(1, 100001):
   if (l < k and (l + x[i]) >= k ):
      print(i)
      exit()

   l += x[i]
# Original solution
n,k=list(map(int,input().split()))
listn=[]
for a in range(n):
    b,c=list(map(int,input().split()))
    listn+=[b]*c
listn.sort()
print((listn[k-1]))

# Optimized solution
class Number:
    def __init__(self,number,qty):
        self.qty=qty
        self.number=number

n,k=list(map(int,input().split()))
listn=[]
for a in range(n):
    b,c=list(map(int,input().split()))
    listn.append(Number(b,c))
listn.sort(key=lambda x:x.number)
count=k
for a in listn:
    if a.qty>=count:
        print((a.number))
        break
    else:
        count-=a.qty
# Original solution
f = lambda: list(map(int,input().split()))
f_ = lambda: [int(x)-1 for x in input().split()]

n,k = f()
l = []
for _ in range(n):
    a,b = f()
    l += [a]*b
print((sorted(l)[k-1]))

# Optimized solution
f = lambda: list(map(int,input().split()))
f_ = lambda: [int(x)-1 for x in input().split()]

n,k = f()
d = []
for _ in range(n):
    a,b = f()
    d.append((a,b))
d.sort(key=lambda x: x[0])
count = 0
for x,y in d:
    count += y
    if count >= k:
        break
print(x)
# Original solution
n, k = list(map(int, input().split()))

a = []
b = []
for _ in range(n):
    ta, tb = list(map(int, input().split()))
    a.append(ta)
    b.append(tb)

ret = []
tb = 0
i = 0
for i in range(n):
    ret.extend([a[i]] * b[i])

ret = sorted(ret)
print((ret[k-1]))

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

items = dict()
for _ in range(n):
    ta, tb = list(map(int, input().split()))
    if ta in list(items.keys()):
        items[ta] += tb
    else:
        items[ta] = tb

items = sorted(items.items())

tb = 0
key = 0
for key, val in items:
    tb += val
    if tb >= k:
        break
print(key)
# Original solution
N, K = [int(x) for x in input().split()]

array = []
for i in range(N):
    a, b = [int(x) for x in input().split()]
    array.extend([a for x in range(b)])

array.sort()
print((array[K-1]))


# Optimized solution
N, K = [int(x) for x in input().split()]

array = []
count = 0
for i in range(N):
    array.append(tuple(map(int, input().split())))

array.sort()
K -= 1
for tup in array:
    if K < tup[1]:
        print((tup[0]))
        break
    else:
        K -= tup[1]
# Original solution
#-*- coding: utf-8 -*-

n, k = list(map(int, input().split()))
src = []
for i in range(n):
    src.append(list(map(int, input().split())))
src.sort(key=lambda x:x[0]) # 0番目の要素でソート

data = []
for a, b in src:
    for i in range(b):
        data.append(a)

print(data[k-1])

# Optimized solution
#-*- coding: utf-8 -*-

def get_ans():
    n, k = list(map(int, input().split()))
    src = []
    for i in range(n):
        src.append(list(map(int, input().split())))
    src.sort(key=lambda x:x[0]) # 0番目の要素でソート

    cnt = 0
    for a, b in src:
        cnt = cnt + b
        if cnt >= k:
            return a
            break
    return src[n-1][1]

if __name__ == '__main__':
    print(get_ans())
# Original solution
n, k = list(map(int, input().split()))
A = []
for i in range(n):
    a, b = list(map(int, input().split()))
    B = [a] * b
    A.extend(B)
A = sorted(A)
print((A[k-1]))

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

A = []
B = []
for i in range(n):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

C = list(zip(A, B))
C = sorted(C)
A, B = list(zip(*C))
for i in range(n):
    a = A[i]
    b = B[i]
    k -= b
    if k <= 0:
        print(a)
        break
# Original solution
N,K = list(map(int,input().split()))
array = []

for i in range(N):
    a,b = list(map(int,input().split()))
    for i in range(b):
        array.append(a)
array.sort()
print((array[K-1]))

# Optimized solution
N,K = list(map(int,input().split()))
array = []
sum = 0
for i in range(N):
    a,b = list(map(int,input().split()))
    array.append([a,b])
array.sort(key = lambda x:x[0])
for i in range(N):
    sum += array[i][1]
    if sum >= K:
        print((array[i][0]))
        exit()
# Original solution
N,K=list(map(int,input().split()))
a=[]
for i in range(N):
    b,c=list(map(int,input().split()))
    for j in range(c):
        a.append(b)
a.sort()
print((a[K-1]))


# Optimized solution
N,K=list(map(int,input().split()))
a=[]*N
b=0
for i in range(N):
    a.append(list(map(int,input().split())))
a.sort()
for i in range(N):
    b+=a[i][1]
    if b>=K:
      print((a[i][0]))
      exit()
# Original solution
n, k = list(map(int, input().split()))

arr = []
for i in range(n):
  a = list(map(int, input().split()))
  for j in range(a[1]):
    arr.append(a[0])
  
arr.sort()
print((arr[k - 1]))

# Optimized solution
n, k = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(n)]

ab.sort(key=lambda x: x[0])
index = 0
for i in range(n):
  index += ab[i][1]
  if index >= k:
    ans = ab[i][0]
    break

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

for _ in range(N):
  a, b = list(map(int, input().split()))
  A += [a]*b
A.sort()
print((A[K-1]))

# Optimized solution
N, K = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x:x[0])

total = 0
for a, b in AB:
  total += b
  if total >= K:
    print(a)
    exit()
# Original solution
n, k = list(map(int, input().split()))
a = []
b = []
for i in range(n):
  a_, b_ = list(map(int, input().split()))
  a.append(a_)
  b.append(b_)

res = []
for i in range(n):
  for _ in range(b[i]):
    res.append(a[i])
#print(res)
res.sort()
#print(res)
print((res[k-1]))

# Optimized solution
n, k = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]
#print(ab)
ab.sort()
#print(ab)
for i in range(n):
  k = k-ab[i][1]
  if k <= 0:
    print((ab[i][0]))
    exit()
# Original solution
n,k = list(map(int,input().split()))
ls = []

for i in range(n):
    a,b = [int(i) for i in input().split()]
    tmp = [a] * b
    ls.append(tmp)

ls = sum(ls,[])
ls.sort()
print((ls[k-1]))

# Optimized solution
n,k = list(map(int,input().split()))
ls = []
b_num = 0

for i in range(n):
    a,b = [int(i) for i in input().split()]
    if b_num <= k:
        tmp = [a] * b
        ls.extend(tmp)
        ls.sort()
        b_num += b
    else:
        if(a <= ls[-1]):
            tmp = [a] * b
            ls.extend(tmp)
            ls.sort()
        
print((ls[k-1]))
# Original solution
n,k = list(map(int,input().split()))
ls = []
b_num = 0

for i in range(n):
    a,b = [int(i) for i in input().split()]
    if b_num < k:
        tmp = [a] * b
        ls.extend(tmp)
        #ls.sort()
        b_num += b
    else:
        if(a <= max(ls)):
            tmp = [a] * b
            ls.extend(tmp)

ls.sort()
print((ls[k-1]))

# Optimized solution
n,k = list(map(int,input().split()))
ls = []

for i in range(n):
    a,b = [int(i) for i in input().split()]
    ls.append([a,b])

ls.sort()
for a,b in ls:
    if b >= k:
        print(a)
        break
    else:
        k -= b
# Original solution
def resolve():
    '''
    code here
    '''

    N, K = [int(item) for item in input().split()]
    queries = [[int(item) for item in input().split()] for _ in range(N)]

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

    que = []
    cnt = 0
    for num, val in queries:
        que += [num]*val
        cnt += val
        if cnt >= K:
            break

    print((que[K-1]))

if __name__ == "__main__":
    resolve()


# Optimized solution
def resolve():
    '''
    code here
    '''

    N, K = [int(item) for item in input().split()]
    queries = [[int(item) for item in input().split()] for _ in range(N)]

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

    temp_que = []
    for num, val in queries:
        temp_que = [num]*val
        K -= val
        if K <= 0:
            break

    print((temp_que[K-1]))

if __name__ == "__main__":
    resolve()
# Original solution
def resolve():
    '''
    code here
    '''

    N, K = [int(item) for item in input().split()]
    queries = [[int(item) for item in input().split()] for _ in range(N)]

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

    temp_que = []
    for num, val in queries:
        temp_que = [num]*val
        K -= val
        if K <= 0:
            break

    print((temp_que[K-1]))

if __name__ == "__main__":
    resolve()


# Optimized solution
def resolve():
    '''
    code here
    '''

    N, K = [int(item) for item in input().split()]
    queries = [[int(item) for item in input().split()] for _ in range(N)]

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

    temp_que = []
    for num, val in queries:
        temp_que = num
        K -= val
        if K <= 0:
            break

    print(temp_que)

if __name__ == "__main__":
    resolve()
# Original solution
n, k = list(map(int, input().split()))
L = []

for i in range(n):
  a, b = list(map(int, input().split()))
  for j in range(b):
    L.append(a)

L.sort()
print((L[k-1]))

# Optimized solution
n, k = list(map(int, input().split()))
L = [0]*(pow(10,5)+1)

for i in range(n):
  a, b = list(map(int, input().split()))
  L[a] += b

s = 0
for i in range(pow(10,5)+1):
  s += L[i]
  if s >= k:
    print(i)
    break
# Original solution
n,k = list(map(int,input().split()))
num = 0
q = []
for i in range(n):
    a,b = list(map(int,input().split()))
    q.append((a,b))
q.sort()
for i in range(n):
    a, b = q[i][0], q[i][1]
    num += b
    if num >= k:
        print(a)
        exit()



# Optimized solution
n,k = list(map(int,input().split()))
cnt = 0
num = []
for i in range(n):
    a,b = list(map(int,input().split()))
    num.append((a,b))
num.sort()
for i in range(n):
    cnt += num[i][1]
    if cnt >= k:
        print((num[i][0]))
        exit()
# Original solution
N, K = list(map(int, input().split()))
l = []
for i in range(N):
    a, b = list(map(int, input().split()))
    l.extend([a] * b)
print((sorted(l)[K-1]))

# Optimized solution
N, K = list(map(int, input().split()))
l = [0] * 10 ** 5
for i in range(N):
    a, b = list(map(int, input().split()))
    l[a-1] += b
count = 0
for j in range(10**5):
    count += l[j]
    if count >= K:
        print((j+1))
        break
# Original solution
N, K = list(map(int, input().split()))
big_array = list()

for _ in range(N):
    a, b = list(map(int, input().split()))
    big_array += [a]*b

big_array.sort()

print((big_array[K-1]))


# Optimized solution
N, K = list(map(int, input().split()))
val_dict = dict()

for _ in range(N):
    a, b = list(map(int, input().split()))
    val_dict[a] = val_dict.get(a, 0) + b

val_keys = sorted(val_dict.keys())

K_rest = K
for key in val_keys:
    K_rest -= val_dict[key]
    if K_rest <= 0:
        print(key)
        break
# Original solution
def bakt():
    len_s = [0 for _ in range(int(1e+5+1))]
    ans = 0
    N, K = list(map(int, input().split()))
    for _ in range(N):
        a, b = list(map(int, input().split()))
        len_s[a] += b
    len_a = 0

    for i, j in enumerate(len_s):
        len_a += j 
        if len_a >= K and ans == 0:
            ans = i
    print(ans)
if __name__ == '__main__':
    bakt()

# Optimized solution
def bakt():
    len_s = [0]*int(1e+5+1)
    N, K = list(map(int, input().split()))
    for _ in range(N):
        a, b = list(map(int, input().split()))
        len_s[a] += b
    len_a = 0
    for i, j in enumerate(len_s):
        len_a += j 
        if len_a >= K:
            print(i)
            break
            
            
if __name__ == '__main__':
    bakt()
# Original solution
from itertools import accumulate
from bisect import bisect_left

N, K = [int(i) for i in input().split()]

memo = [0] * 100010
for _ in range(N):
    a, b = [int(i) for i in input().split()]
    memo[a] += b

print((bisect_left(list(accumulate(memo)), K)))

# Optimized solution
from sys import stdin
input = stdin.readline

from itertools import accumulate
from bisect import bisect_left

N, K = [int(i) for i in input().split()]

memo = [0] * 100010
for _ in range(N):
    a, b = [int(i) for i in input().split()]
    memo[a] += b

print((bisect_left(list(accumulate(memo)), K)))
# Original solution
from sys import stdin
input = stdin.readline

from itertools import accumulate
from bisect import bisect_left

N, K = [int(i) for i in input().split()]

memo = [0] * 100010
for _ in range(N):
    a, b = [int(i) for i in input().split()]
    memo[a] += b

print((bisect_left(list(accumulate(memo)), K)))

# Optimized solution
from sys import stdin
input = stdin.readline

from itertools import accumulate
from bisect import bisect_left

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

memo = [0] * 100010
for _ in range(N):
    a, b = list(map(int, input().split()))
    memo[a] += b

print((bisect_left(list(accumulate(memo)), K)))
# Original solution
line_one = input().split()
n = int(line_one[0])
k = int(line_one[1])

l = []
#d = {}
for i in range(n):
    line_one2 = input().split()
    a1 = int(line_one2[0])
    b1 = int(line_one2[1])
    if a1 in l:
        #d[a1] += b1
        l[a1][1] += b1
    else:
        l.append( ( a1, b1 ))
        #//d[a1] = b1

l.sort()
count = 0
for item in l:
    count += item[1]
    if k <= count:
        print(item[0])
        break


# Optimized solution
line_one = input().split()
n = int(line_one[0])
k = int(line_one[1])

l = []
#d = {}
for i in range(n):
    line_one2 = input().split()
    a1 = int(line_one2[0])
    b1 = int(line_one2[1])
    l.append( ( a1, b1 ))
    #if a1 in l:
    #    #d[a1] += b1
    #    l[a1][1] += b1
    #else:
    #    l.append( ( a1, b1 ))
    #    #//d[a1] = b1

#l.sort()
l = sorted(l, key=lambda x: x[0])
count = 0
for item in l:
    count += item[1]
    if k <= count:
        print(item[0])
        break
# Original solution
import heapq

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

q = []
for i in range(n):
    q.append(list(map(int, input().split())))

heapq.heapify(q)

cnt = 0
while cnt < k:
    a, b = heapq.heappop(q)
    cnt += b
    
print(a)

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

q = []
for i in range(n):
    q.append(list(map(int, input().split())))

q = sorted(q, key=lambda x:x[0])
cnt = 0
i = 0
while cnt < k:
    a, b = q[i]
    cnt += b
    i += 1
print(a)
# Original solution
N, K = list(map(int,input().split()))
A = sorted([list(map(int,input().split())) for k in range(N)])

for a in A:
    K -= a[1]
    if K <= 0:
        print((a[0]))
        exit(0)

# Optimized solution
N, K = list(map(int,input().split()))
L = sorted([list(map(int,input().split())) for _ in range(N)])
for e in L:
    K -= e[1]
    if K <= 0:
        print((e[0]))
        exit(0)
# Original solution
N, K = list(map(int,input().split()))
L = sorted([list(map(int,input().split())) for _ in range(N)])
for e in L:
    K -= e[1]
    if K <= 0:
        print((e[0]))
        exit(0)


# Optimized solution
N, K = list(map(int,input().split()))
L = []
for k in range(N):
    L.append(list(map(int,input().split())))
L = sorted(L)
for e in L:
    K -= e[1]
    if K <= 0:
        print((e[0]))
        exit(0)
# Original solution
n,k=(int(i) for i in input().split())
a=[[int(i) for i in input().split()] for i in range(n)]
#print(a)

ans=0
while ans < k:
    mina=min(a)
#    print(a)
    a.remove(mina)
    ans+=mina[1]
    
print((mina[0]))


# Optimized solution
n,k=(int(i) for i in input().split())
a=[[int(i) for i in input().split()] for i in range(n)]
#print(a)

a.sort()
i=0
ans=0
while ans < k:
    ans+=a[i][1]
    i+=1

print((a[i-1][0]))