There is an empty array.
The following N operations will be performed to insert integers into the array.
In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.
Find the K-th smallest integer in the array after the N operations.
For example, the 4-th smallest integer in the array \{1,2,2,3,3,3\} is 3.

-----Constraints-----
 - 1≤N≤10^5 
 - 1≤a_i,b_i≤10^5 
 - 1≤K≤b_1…+…b_n
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:  
N K
a_1 b_1
:  
a_N b_N

-----Output-----
Print the K-th smallest integer in the array after the N operations.  

-----Sample Input-----
3 4
1 1
2 2
3 3

-----Sample Output-----
3

The resulting array is the same as the one in the problem statement.
[{"code": "n, k = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(n)]\n\nab.sort()\n\nnum_sum = 0\n\nfor a, b in ab:\n    num_sum += b\n    if num_sum >= k:\n        print(a)\n        return\n", "passed": true, "time": 0.15, "memory": 14360.0, "status": "done"}, {"code": "N, K = map(int, input().split())\narr = [0]*(10**5+1)\n\nfor i in range(N):\n    a,b = map(int, input().split())\n    arr[a] += b\n\ns = 0\nfor i in range(10**5+1):\n    s += arr[i]\n    if s >= K:\n        print(i)\n        break", "passed": true, "time": 0.15, "memory": 14304.0, "status": "done"}, {"code": "N, K = map(int, input().split())\ns = 0\nab = [[0, 0] for i in range(N)]\nfor i in range(N):\n    ab[i][0], ab[i][1] = map(int, input().split())\nab = sorted(ab)\n\n#print(ab)\nfor i in range(N):\n    s += ab[i][1]\n    if s >= K:\n        print(ab[i][0])\n        break", "passed": true, "time": 0.17, "memory": 14184.0, "status": "done"}, {"code": "from sys import stdin\ninput = stdin.readline\n \nfrom itertools import accumulate\nfrom bisect import bisect_left\n \nN, K = map(int, input().split())\n \nmemo = [0] * 100010\nfor _ in range(N):\n    a, b = map(int, input().split())\n    memo[a] += b\n \nprint(bisect_left(list(accumulate(memo)), K))", "passed": true, "time": 0.14, "memory": 17752.0, "status": "done"}, {"code": "n, k = list(map(int, input().split()))\nbucket = [0] * 10 ** 5\nfor i in range(n):\n    a, b = list(map(int, input().split()))\n    bucket[a - 1] += b\n\nsum_b = 0\nfor i in range(len(bucket)):\n    sum_b += bucket[i]\n    if sum_b >= k:\n        print((i + 1))\n        break\n", "passed": true, "time": 0.15, "memory": 14332.0, "status": "done"}, {"code": "N,K = map(int,input().split())\nls = [list(map(int,input().split())) for _ in range(N)]\n\nls.sort(key=lambda x: x[0])\ns = 0\n\nfor i in range(N):\n  s += ls[i][1]\n  if s >= K: break\n    \nprint(ls[i][0])", "passed": true, "time": 0.19, "memory": 14324.0, "status": "done"}, {"code": "f=lambda l:map(int,l.split())\nN,K=f((p:=input)());c=[0]*(l:=10**5+1);s=0\nfor i in (r:=range)(N):a,b=f(p());c[a]+=b\nfor i in r(l):\n    s+=c[i]\n    if s>=K: print(i);break", "passed": true, "time": 0.23, "memory": 14116.0, "status": "done"}, {"code": "n,k = map(int, input().split())\na = []\nfor i in range(n):\n\ta.append(list(map(int, input().split())))\n\na = sorted(a, key = lambda x:x[0])\n\nx = 0\nfor i in a:\n\tx += i[1]\n\tif x >= k:\n\t\tbreak\nprint(i[0])", "passed": true, "time": 0.22, "memory": 14284.0, "status": "done"}, {"code": "n, k = map(int, input().split())\nal = [0]*(10**5+1)\n\nfor _ in range(n):\n    a, b = map(int, input().split())\n    al[a] += b\n\ncnt = 0\ni = 0\nwhile cnt < k:\n    cnt += al[i]\n    i += 1\n\nprint(i-1)", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "n,k=map(int,input().split())\ns=[0]*10**5\nfor i in range(n):\n    a,b=map(int,input().split())\n    s[a-1]+=b\ni=0\nwhile k>0:\n    k-=s[i]\n    i+=1\nprint(i)", "passed": true, "time": 0.22, "memory": 14560.0, "status": "done"}, {"code": "N,K = list(map(int,input().split()))\nA = []\nfor i in range(N):\n    a,b = list(map(int,input().split()))\n    A.append([a,b])\nA.sort()\n\nfor i in range(N):\n    K = K - A[i][1]\n    if K <= 0:\n        print((A[i][0]))\n        return\n", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "def main():\n    N, K = list(map(int, input().split()))\n    lis = []\n    for i in range(N):\n        a, b = list(map(int, input().split()))\n        lis.append((a, b))\n\n    lis = sorted(lis)\n\n    for i in range(N):\n        K -= lis[i][1]\n        if K <= 0:\n            print((lis[i][0]))\n            break\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.24, "memory": 14156.0, "status": "done"}, {"code": "from collections import defaultdict\nn,k = map(int, input().split())\nans = 0\nal = []\nd = defaultdict(int)\nfor i in range(n):\n  a,b = map(int, input().split())\n  al.append(a)\n  d[a] += b\nal = list(set(al))  \nal.sort()\nfor i in al:\n  if k > d[i]:\n    k -= d[i]\n  else:\n    print(i)\n    break", "passed": true, "time": 0.15, "memory": 14048.0, "status": "done"}, {"code": "# ABC 061: C \u2013 Big Array\nN, K = [int(i) for i in input().split()]\na, b = [], []\nfor _ in range(N):\n    tmp = input().split()\n    a.append(int(tmp[0]))\n    b.append(int(tmp[1]))\n\ncnt = [0] * (100000 + 1)\n\nfor i in range(N):\n    cnt[a[i]] += b[i]\n\nfor j in range(100000 + 1):\n    if K <= cnt[j]:\n        print(j)\n        break\n    K -= cnt[j]", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "n,k=map(int,input().split())\nl=sorted([list(map(int,input().split()))for i in range(n)])\nfor a,b in l:\n    k-=b\n    if k<1:\n        print(a);break", "passed": true, "time": 0.14, "memory": 14060.0, "status": "done"}, {"code": "\n\ndef main():\n    N, K = list(map(int, input().split()))\n    box = []\n    for _ in range(N):\n        ab = list(map(int, input().split()))\n        box.append(ab)\n\n    box.sort(key= lambda x: x[0])\n    ans = 0\n    for b in box:\n        if ans + b[1] < K:\n            ans += b[1]\n        else:\n            print((b[0]))\n            return\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14272.0, "status": "done"}, {"code": "n,k=map(int,input().split())\nans=[0]*(10**5+1)\nfor i in range(n):\n    a,b=map(int,input().split())\n    ans[a]+=b\n    \nfor i in range(len(ans)):\n    k-=ans[i]\n    if k<=0:\n        print(i)\n        break", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "N, K = map(int, input().split())\na = []\nb = []\nSum = 0\nfor i in range(N):\n    x, y = map(int, input().split())\n    a.append(x)\n    b.append(y)\ns = [*range(len(a))]\nsort_s = sorted(s, key = lambda i: a[i])\nsort_a = [a[i] for i in sort_s]\nsort_b = [b[i] for i in sort_s]\nfor i in range(N):\n    Sum += sort_b[i]\n    if Sum >= K:\n        print(sort_a[i])\n        break", "passed": true, "time": 0.23, "memory": 14216.0, "status": "done"}, {"code": "from xml.dom import minidom\n\n\nn, k = list(map(int, input().split()))\n\nAB = [list(map(int, input().split())) for _ in range(n)]\nAB.sort()\n\nnow = -1\nidx = 0\nwhile k > 0:\n    if idx >= n:\n        break\n    a, b = AB[idx]\n    k -= b\n    now = a\n    idx += 1\nprint(now)\n", "passed": true, "time": 0.16, "memory": 16012.0, "status": "done"}, {"code": "n,k=map(int,input().split())\ncount=0\nba=[0]*(10**5+1)\nfor i in range(n):\n    a,b=map(int,input().split())\n    ba[a]+=b\n \nfor i in range(len(ba)):\n    k-=ba[i]\n    if k<=0:\n        print(i)\n        break", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "n,k=[int(i) for i in input().split()]\n\nclass Number:\n    def __init__(self,number,times):\n        self.number=number\n        self.times=times\n\n    def __eq__(self, other):\n        if self.number==other.number:\n            return True\n        return False\n    def __le__(self, other):\n        if self.number<=other.number:\n            return True\n        return False\n    def __lt__(self, other):\n        if self.number<other.number:\n            return True\n        return False\n    def __ge__(self, other):\n        if self.number>=other.number:\n            return True\n        return False\n    def __gt__(self, other):\n        if self.number>other.number:\n            return True\n        return False\n\nnumber_list=[]\nfor i in range(n):\n    number,times=[int(i) for i in input().split()]\n    number_list.append(Number(number,times))\n\nnumber_list.sort()\n\n\ndef get(number_list,k):\n    i=0\n    while True:\n        taishou=number_list[i]\n        k=k-taishou.times\n        if k<=0:\n            return taishou.number\n        else:\n            i+=1\nprint(get(number_list,k))", "passed": true, "time": 0.14, "memory": 14336.0, "status": "done"}, {"code": "n, k = list(map(int, input().split()))\na = [0] * n\nb = [0] * n\nfor i in range(n):\n    a[i], b[i] = list(map(int ,input().split()))\n\n\njudge = 0\ndic = {}\n\n\nfor i in range(n):\n    if a[i] in dic:\n        dic[a[i]] += b[i]\n    else:\n        dic[a[i]] = b[i]\n#print(dic)\ndic = list(dic.items())\ndic.sort()\n#print(dic)\n\n\nfor i in range(10**9):\n    if judge >= k:\n        print((dic[i-1][0]))\n        break\n    else:\n        judge += int(dic[i][1])\n    #print(judge)\n", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "n, k = list(map(int, input().split()))\nsum_b = 0\nab_list = []\n\nfor i in range(n):\n    ab_list.append(list(map(int, input().split())))\n\nab_list.sort()\nfor i in range(n):\n    a, b = ab_list[i]\n    sum_b += b\n    if sum_b >= k:\n        print(a)\n        break\n", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "n,k=map(int,input().split())\nab=[list(map(int,input().split())) for i in range(n)]\nres=k\nab.sort()\nfor i in range(n):\n  res-=ab[i][1]\n  if res<=0:\n    print(ab[i][0])\n    return", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "N, K = map(int, input().split())\nd = {}\nkey = set([])\nfor _ in range(N):\n  a, b = map(int, input().split())\n  if a in key:\n    d[str(a)] += b\n  else:\n    key.add(a)\n    d[str(a)] = b\nkey = sorted(list(key))\nfor k in key:\n  if d[str(k)] < K:\n    K -= d[str(k)]\n  else:\n    print(k)\n    break", "passed": true, "time": 0.22, "memory": 14176.0, "status": "done"}, {"code": "#!/usr/bin/env python\n\nn, k = list(map(int, input().split()))\na = [0 for _ in range(n)]\nb = [0 for _ in range(n)]\nfor i in range(n):\n    a[i], b[i] = list(map(int, input().split()))\n\nd = {}\nfor i in range(n):\n    if a[i] not in d:\n        d[a[i]] = b[i]\n    else:\n        d[a[i]] += b[i]\n\nd = sorted(list(d.items()), key=lambda x: x[0])\n\ntmp = 0 \nfor i in range(len(d)):\n    tmp += d[i][1]\n    if tmp >= k:\n        print((d[i][0]))\n        return\n", "passed": true, "time": 0.14, "memory": 14356.0, "status": "done"}, {"code": "n, k = map(int,input().split())\n\nq = []\nfor i in range(n):\n    q.append(list(map(int, input().split())))\n\nq = sorted(q, key=lambda x:x[0])\ncnt = 0\ni = 0\nwhile cnt < k:\n    a, b = q[i]\n    cnt += b\n    i += 1\nprint(a)", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "n, k = map(int, input().split(\" \"))\na = sorted([list(map(int, input().split(\" \"))) for i in range(n)])\ncount = 0\nfor x, y in a:\n  count += y\n  if k <= count:\n    print(x)\n    break\nelse:\n  print(\"None\")", "passed": true, "time": 0.15, "memory": 14132.0, "status": "done"}, {"code": "f=lambda:map(int,input().split());N,K=f()\nfor a,b in sorted([*f()]for _ in[0]*N):\n    K-=b\n    if K<1:print(a);return", "passed": true, "time": 0.22, "memory": 14264.0, "status": "done"}, {"code": "N,K = map(int,input().split())\nans = []\nfor i in range(N):\n    ab = list(map(int,input().split()))\n    ans.append(ab)\nans.sort()\nl = 0\nfor i in range(N):\n    l += ans[i][1]\n    if l >= K:\n        s = i\n        break\nprint(ans[s][0])", "passed": true, "time": 0.21, "memory": 14140.0, "status": "done"}, {"code": "N, K = list(map(int, input().split()))\nmemory = {}\nS = []\n\nfor i in range(N):\n    a, b = list(map(int, input().split()))\n    try:\n        memory[a] += b\n    except KeyError:\n        memory[a] = b\n\nA = sorted(list(memory.keys()))\nfor a in A:\n    if not S:\n        S.append(memory[a])\n    else:\n        S.append(S[-1] + memory[a])\n\nfor i in range(N):\n    if S[i] >= K:\n        print((A[i]))\n        break\n", "passed": true, "time": 1.5, "memory": 14072.0, "status": "done"}, {"code": "N,K=list(map(int,input().split()))\nab=list(list(map(int,input().split())) for _ in range(N))\nab.sort()\n\ni=0\nwhile K>0:\n    K-=ab[i][1]\n    i+=1\nprint((ab[i-1][0]))\n", "passed": true, "time": 0.2, "memory": 14136.0, "status": "done"}, {"code": "n,k = map(int,input().split())\nlst = [0]*10**5\nfor i in range(n):\n  a,b=map(int,input().split())\n  lst[a-1] += b\n  ans = 0\nfor j in range(10**5):\n  ans += lst[j]\n  if ans >= k:\n    print(j+1)\n    return", "passed": true, "time": 0.21, "memory": 14176.0, "status": "done"}, {"code": "N, K = list(map(int, input().split()))\n\ncnt = 0\n\nls = []\n\nfor i in range(N):\n    ls.append(list(map(int, input().split())))\n\nls.sort(key=lambda x: x[0])\n\nfor a, b in ls:\n    cnt += b\n    if cnt >= K:\n        break\n\nprint(a)\n", "passed": true, "time": 0.21, "memory": 14100.0, "status": "done"}, {"code": "n, k = map(int, input().split())\nS = set()\nD = dict()\nfor _ in range(n):\n    a, b = map(int, input().split())\n    if a in S:\n        D[a] += b\n    else:\n        S.add(a)\n        D[a] = b\nL = sorted(S)\ncnt = 0\nfor l in L:\n    cnt += D[l]\n    if cnt >= k:\n        print(l)\n        break", "passed": true, "time": 0.21, "memory": 14264.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Sep 28 01:21:16 2020\n\n@author: liang\n\"\"\"\n\n#\u30d0\u30b1\u30c4\u30bd\u30fc\u30c8O(n)\nN, K = map(int,input().split())\nnum = [0]*(10**5+1)\nfor i in range(N):\n    a, b = map(int,input().split())\n    num[a] += b\n\ntmp = 0\nfor i in range(10**5+ 1):\n    tmp += num[i]\n    if tmp >= K:\n        print(i)\n        break", "passed": true, "time": 0.21, "memory": 14272.0, "status": "done"}, {"code": "def main2():\n    N, K = map(int, input().split())\n    limit = 10**5\n\n    ins = [0 for _ in range(limit + 1)]\n\n    for _ in range(N):\n        a, b = map(int, input().split())\n        ins[a] += b\n\n    c = 0\n    for i in range(1, limit + 1):\n        c += ins[i]\n\n        if c >= K:\n            print(i)\n            return\n\ndef __starting_point():\n    main2()\n__starting_point()", "passed": true, "time": 0.21, "memory": 14004.0, "status": "done"}, {"code": "N,K = map(int,input().split())\nans = []\n\nfor i in range(N):\n    ab = list(map(int,input().split()))\n    ans.append(ab)\n\nans.sort()\n\nl = 0\n \nfor i in range(N):\n    l += ans[i][1]\n    if l >= K:\n        s = i\n        break\nprint(ans[s][0])", "passed": true, "time": 0.22, "memory": 14328.0, "status": "done"}, {"code": "n, k = list(map(int, input().split()))\nl = sorted([list(map(int, input().split()))for i in range(n)])\nfor a, b in l:\n    k -= b\n    if k <1:\n        print(a)\n        break\n", "passed": true, "time": 0.14, "memory": 14136.0, "status": "done"}, {"code": "n,k = [int(x) for x in input().split()]\na = []\nfor i in range(n):\n  a.append([int(x) for x in input().split()])\na.sort()\n\nc = 0\nwhile k > 0:\n  k -= a[c][1]\n  c += 1\n\nprint(a[c-1][0])", "passed": true, "time": 0.2, "memory": 14284.0, "status": "done"}, {"code": "N, K = map(int, input().split())\n\nlst = [list(map(int, input().split())) for _ in range(N)]\nlst.sort(key=lambda x: x[0])\ns = 0\nfor i in range(N):\n\ts += lst[i][1]\n\tif s >= K: break\nprint(lst[i][0])", "passed": true, "time": 0.15, "memory": 14216.0, "status": "done"}, {"code": "n,k=map(int,input().split())\nab=[list(map(int,input().split())) for i in range(n)]\nab.sort()\n\ndef slv():\n    cnt = 0\n    for i in range(n):\n        cnt += ab[i][1]\n        if cnt >= k:\n            return print(ab[i][0])\n\nslv()", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "n, k = list(map(int, input().split()))\nli = []\nfor i in range(n):\n    temp = list(map(int, input().split()))\n    li.append(temp)\n#print(li)\nli.sort()\n#print(li)\ntotal=0\nfor i in range(n):\n    if i==n-1:\n        #print(\"here\")\n        print((li[i][0]))\n        break\n    total+=li[i][1]\n    if total<k:\n        continue\n    else:\n        print((li[i][0]))\n        break\n    #print(i, total)\n", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "def main():\n    N, K = list(map(int, input().split()))\n    l = []\n    cnt = 0\n    for _ in range(N):\n        a, b = list(map(int, input().split()))\n        l.append((a, b))\n    l.sort(key=lambda x: x[0])\n    for a, x in l:\n        cnt += x\n        if cnt >= K:\n            print(a)\n            return\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.2, "memory": 14188.0, "status": "done"}, {"code": "from collections import defaultdict as dd\nfrom itertools import count\nN, K = map(int, input().split())\nCnt = dd(lambda:0)\nfor _ in range(N):\n    a, b = map(int, input().split())\n    Cnt[a] += b\n\nnum = 0\nfor i in count(1,1):\n    num += Cnt[i]\n    if num >= K:\n        print(i)\n        break", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "N, K = map(int,input().split())\nls = [0]+[0]*10**5\nfor i in range(N):\n    a,b = map(int,input().split())\n    ls[a] += b\nii = 0\nfor i in range(1,10**5+1):\n    ii += ls[i]\n    if ii >= K:\n        ans = i\n        break\n    else:\n        continue\nprint(ans)", "passed": true, "time": 0.14, "memory": 14940.0, "status": "done"}, {"code": "n,k=map(int,input().split())\nnum,count=[0]*((10**5)+1),0\nfor _ in range(n):\n  a,b=map(int,input().split())\n  num[a]+=b\nfor i in range(len(num)):\n  count+=num[i]\n  if count >= k:\n    print(i)\n    break", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\n\ndef main():\n    n,k = map( int , input().split() )\n    A = [ 0 for i in range( 10 ** 5 + 1 ) ]\n    for i in range(n):\n        a,b = map( int , input().split() )\n        A[ a ] += b\n    \n    i = 0\n    sum = 0\n    while( sum < k ):\n        i += 1\n        sum += A[i]\n    print(i)\n\n\n\nmain()", "passed": true, "time": 0.14, "memory": 14136.0, "status": "done"}, {"code": "N,K=list(map(int,input().split()))\ncount=[0]*(100001)\nfor i in range(1,N+1) :\n  a,b=list(map(int,input().split()))\n  count[a]+=b\nfor i in range(1,100001) :\n  if K<=count[i] :\n    print(i)\n    break\n  K-=count[i]\n", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "# C - Big Array\ndef main():\n    n, k = map(int, input().split())\n    ab = [list(map(int, input().split())) for _ in range(n)]\n    ab.sort()\n\n    i = 0\n\n    while k > 0:\n        k -= ab[i][1]\n        i += 1\n    else:\n        print(ab[i-1][0])\n\nif __name__ ==  \"__main__\":\n    main()", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "from collections import defaultdict\nN,K = list(map(int,input().split()))\nN_List = defaultdict(int)\nfor i in range(N):\n    Num,Cnt = list(map(int,input().split()))\n    N_List[Num] += Cnt\n\nN_List = sorted(list(N_List.items()), key=lambda x:x[0])\n\nans = 0\nfor Key,Value in N_List:\n    ans += Value\n    if ans >= K:\n        print(Key)\n        break\n\n", "passed": true, "time": 0.21, "memory": 14064.0, "status": "done"}, {"code": "n,k=map(int,input().split())\ns=[0]*10**5\nfor i in range(n):\n    a,b=map(int,input().split())\n    s[a-1]+=b\ni=0\nwhile k>0:\n    k-=s[i]\n    i+=1\nprint(i)", "passed": true, "time": 0.15, "memory": 14748.0, "status": "done"}, {"code": "#95 C - Big Array\nN,K = map(int,input().split())\nlis = []\nfor _ in range(N):\n    a,b = map(int,input().split())\n    lis.append((a,b))\n\nlis = sorted(lis,reverse = False)\n\ncnt = 0\nnum = 0\nfor a,b in lis:\n    cnt += b\n    num = a\n    if cnt >= K:\n        break\nprint(num)", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "N, K = list(map(int, input().split()))\n\nab = [[0, 0]] * N\nfor i in range(N):\n    _a, _b = list(map(int, input().split()))\n    ab[i] = [_a, _b]\nab.sort(key=lambda x:x[0])\n\nj = 0\nindex = 0\nwhile j < K:\n    j += ab[index][1]\n    if j < K:\n        index += 1\n\nprint((ab[index][0]))\n", "passed": true, "time": 0.15, "memory": 14264.0, "status": "done"}, {"code": "#\n# abc061 c\n#\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n    def assertIO(self, input, output):\n        stdout, stdin = sys.stdout, sys.stdin\n        sys.stdout, sys.stdin = StringIO(), StringIO(input)\n        resolve()\n        sys.stdout.seek(0)\n        out = sys.stdout.read()[:-1]\n        sys.stdout, sys.stdin = stdout, stdin\n        self.assertEqual(out, output)\n\n    def test_\u5165\u529b\u4f8b_1(self):\n        input = \"\"\"3 4\n1 1\n2 2\n3 3\"\"\"\n        output = \"\"\"3\"\"\"\n        self.assertIO(input, output)\n\n    def test_\u5165\u529b\u4f8b_2(self):\n        input = \"\"\"10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\"\"\"\n        output = \"\"\"1\"\"\"\n        self.assertIO(input, output)\n\n\ndef resolve():\n    N, K = list(map(int, input().split()))\n    D = [list(map(int, input().split())) for _ in range(N)]\n\n    D.sort()\n    t = 0\n    for d in D:\n        t += d[1]\n        if t >= K:\n            print((d[0]))\n            break\n\n\ndef __starting_point():\n    # unittest.main()\n    resolve()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14608.0, "status": "done"}, {"code": "import heapq\n\nn, k = map(int,input().split())\n\nq = []\nfor i in range(n):\n    q.append(list(map(int, input().split())))\n\nheapq.heapify(q)\n\ncnt = 0\nwhile cnt < k:\n    a, b = heapq.heappop(q)\n    cnt += b\n    \nprint(a)", "passed": true, "time": 0.21, "memory": 14236.0, "status": "done"}, {"code": "#n = int(input())\nn, k = list(map(int, input().split()))\n#l = list(map(int,input().split()))\n#l = [list(map(int,input().split())) for i in range(n)]\ndic = {}\nfor i in range(n):\n    a, b = list(map(int, input().split()))\n    dic[a] = dic.get(a, 0)+b\n\nl = sorted(dic.items())\n\nfor a, b in l:\n    if k <= b:\n        ans = a\n        break\n    k -= b\nprint(ans)\n", "passed": true, "time": 0.15, "memory": 14296.0, "status": "done"}, {"code": "n, k = map(int, input().split())\nd = {}\nfor _ in range(n):\n    a, b = map(int, input().split())\n    if a in d.keys():\n        d[a] += b\n    else:\n        d[a] = b\ncnt = 0\nsorted_d = sorted(d.items(), key=lambda x: x[0])\nfor key, val in sorted_d:\n    cnt += val\n    if k <= cnt:\n        print(key)\n        break", "passed": true, "time": 0.15, "memory": 14040.0, "status": "done"}, {"code": "n,k=map(int,input().split())\na=[]\nfor i in range(n):\n    A=list(map(int,input().split()))\n    a.append(A)\na = sorted(a, key=lambda x: x[0])\nb=0\nfor i in range(n):\n    b+=a[i][1]\n    if b>=k:\n        print(a[i][0])\n        return", "passed": true, "time": 0.24, "memory": 14044.0, "status": "done"}, {"code": "N,K = map(int,input().split())\nnums = []\n\nfor _ in range(N):\n  a,b = map(int,input().split())\n  nums.append([a,b])\n\nnums.sort()\nS = 0\n\nfor i in range(N+1):\n  if S < K:\n    S += nums[i][1]\n  else:\n    print(nums[i-1][0])\n    break", "passed": true, "time": 0.15, "memory": 14172.0, "status": "done"}, {"code": "import math\nfrom math import gcd,pi,sqrt\nINF = float(\"inf\")\n\nimport sys\nsys.setrecursionlimit(10**6)\nimport itertools\nfrom collections import Counter,deque\ndef i_input(): return int(input())\ndef i_map(): return list(map(int, input().split()))\ndef i_list(): return list(i_map())\ndef i_row(N): return [i_input() for _ in range(N)]\ndef i_row_list(N): return [i_list() for _ in range(N)]\ndef s_input(): return input()\ndef s_map(): return input().split()\ndef s_list(): return list(s_map())\ndef s_row(N): return [s_input for _ in range(N)]\ndef s_row_str(N): return [s_list() for _ in range(N)]\ndef s_row_list(N): return [list(s_input()) for _ in range(N)]\n\nimport string\n\ndef main():\n    n,k = i_map()\n\n    cnt = 0\n    l = []\n    for _ in range(n):\n        a,b = i_map()\n        l.append([a,b])\n\n    l.sort()\n    for i,j in l:\n        cnt += j\n        if cnt >= k:\n            print(i)\n            break\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.24, "memory": 14144.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Sep 28 01:14:47 2020\n\n@author: liang\n\"\"\"\n\nN, K = list(map(int,input().split()))\nA = list()\nfor i in range(N):\n    a, b = list(map(int,input().split()))\n    A.append((a,b))\nA.sort(key= lambda x:x[0])\n\ntmp = 0\nfor i in range(N):\n    a, b = A[i]\n    tmp += b\n    if tmp >= K:\n        print(a)\n        break\n", "passed": true, "time": 0.15, "memory": 14396.0, "status": "done"}, {"code": "li = [0]*(10**5+10)\nn,k = map(int, input().split())\nfor i in range(n):\n    a,b = map(int, input().split())\n    li[a] += b\ncnt = 0\nans = 0\nfor i in range(10**5+10):\n    cnt += li[i]\n    ans = i\n    if cnt >= k:\n        break\nprint(ans)", "passed": true, "time": 0.14, "memory": 14344.0, "status": "done"}, {"code": "n, k = map(int, input().split())\nquery = sorted([tuple(map(int, input().split())) for _ in range(n)])\n\ncnt = 0\ni = 0\nwhile cnt < k:\n    a, b = query[i]\n    cnt += b\n    i += 1\nprint(a)", "passed": true, "time": 0.14, "memory": 14224.0, "status": "done"}, {"code": "# s = input()\n# n = len(s) - 1\n# ans = 0\n# for i in range(1 << n):\n#     formula = s[0]\n#     for j in range(n):\n#         if ((i >> j) & 1):\n#             formula += '+' + s[j + 1]\n#         else:\n#             formula += s[j + 1]\n#     ans += eval(formula)\n# print(ans)\nimport sys\n\n\nstdin = sys.stdin\ndef ns(): return stdin.readline().rstrip()\ndef ni(): return int(stdin.readline().rstrip())\ndef nm(): return list(map(int, stdin.readline().split()))\ndef nl(): return list(map(int, stdin.readline().split()))\n\n\ndef main():\n    n, k = nm()\n    A = [0] * (10 ** 5 + 1)\n    for i in range(n):\n        a, b = nm()\n        A[a] += b\n\n    sum_num = 0\n    for i, a in enumerate(A):\n        sum_num += a\n        if sum_num >= k:\n            print(i)\n            return\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.21, "memory": 14216.0, "status": "done"}, {"code": "N,K=map(int,input().split());c=[0]*(l:=10**5+1);s=0\nfor i in range(N):a,b=map(int,input().split());c[a]+=b\nfor i in range(l):\n    s+=c[i]\n    if s>=K: print(i);break", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\ndef main():\n    n, k = list(map(int, input().split()))\n    arr = sorted([list(map(int, input().split())) for i in range(n)])\n    for ab in arr:\n        k -= ab[1]\n        if k <= 0:\n            ans = ab[0]\n            break\n\n    print(ans)\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14288.0, "status": "done"}, {"code": "N,K=map(int,input().split())\nl=[list(map(int,input().split()))for i in range(N)]\nl.sort(key=lambda x: x[0])\nans=0\nfor i in l:\n    if K==0:\n        break\n    K-=min(K,i[1])\n    ans=i[0]\nprint(ans)", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "n,k = list(map(int,input().split()))\nA = []\nfor _ in range(n):\n    A.append(list(map(int,input().split())))\nA.sort(key=lambda x: x[0])\ncnt = 0\nwhile k>0:\n    k-=A[cnt][1]\n    cnt+=1\nprint((A[cnt-1][0]))\n", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "import sys\n\nsys.setrecursionlimit(10 ** 8)\nini = lambda: int(sys.stdin.readline())\ninl = lambda: [int(x) for x in sys.stdin.readline().split()]\nins = lambda: sys.stdin.readline().rstrip()\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\n\n\ndef solve():\n    n, k = inl()\n    v = []\n    for i in range(n):\n        a, b = inl()\n        v.append((a, b))\n    v.sort(reverse=True)\n    c = k - 1\n    while v:\n        a, b = v.pop()\n        if b > c:\n            return a\n        c -= b\n\n\nprint(solve())\n", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "N,K=map(int,input().split())\ncnt=0\nP=[]\nfor i in range(N):\n    a,b=map(int,input().split())\n    P.append((a,b))\n\nP=sorted(P)\nfor i in range(N):\n    cnt+=P[i][1]\n    if cnt>=K:\n        print(P[i][0])\n        break", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "N, K = list(map(int, input().split()))\n\nab = [[0, 0]] * N\nfor i in range(N):\n    _a, _b = list(map(int, input().split()))\n    ab[i] = [_a, _b]\nab.sort(key=lambda x:x[0])\n\n\ntotal = 0\nfor pair in ab:\n    total += pair[1]\n    if total >= K:\n        print((pair[0]))\n        break\n", "passed": true, "time": 0.14, "memory": 14348.0, "status": "done"}, {"code": "N, K = map(int, input().split())\nd = {}\nfor i in range(N):\n    a, b = map(int, input().split())\n    d[a] = d.get(a, 0) + b\n\ncnt = 0\nfor k in sorted(d.keys()):\n    cnt += d[k]\n    if cnt >= K:\n        print(k)\n        break", "passed": true, "time": 0.23, "memory": 14308.0, "status": "done"}, {"code": "n, k = map(int,input().split())\na_b = [ list(map(int, input().split())) for _ in range(n)  ]\na_b = sorted(a_b, key=lambda x: x[0] )\n\ncount = 0\nfor i in range(len(a_b)):\n    a, b = a_b[i]\n    count += b\n    if count >= k:\n        print(a)\n        break", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "n, k = map(int, (input().split()))\narr = [0] * 100100\nfor i in range(n):\n    a, b = map(int, input().split())\n    arr[a] += b\n\ncur = 0\nfor i in range(100100):\n    cur += arr[i]\n    if cur >= k:\n        print(i)\n        break", "passed": true, "time": 0.45, "memory": 14300.0, "status": "done"}, {"code": "N, K = map(int, input().split())\n\nbucket = [0] * (10 ** 5 + 1)\nfor _ in range(N):\n    a, b = map(int, input().split())\n    bucket[a] += b\n\ncnt = 0\nfor i, c in enumerate(bucket):\n    if c == 0:\n        continue\n    cnt += c\n    if cnt >= K:\n        print(i)\n        return", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "N,K=map(int,input().split())\nd={}\nfor i in range(N):\n  a,b=map(int,input().split())\n  if a not in d:\n    d[a]=b\n  else:\n    d[a]+=b\nd=sorted(d.items())\nfor i in d:\n  K-=i[1]\n  if K<=0:\n    print(i[0])\n    break", "passed": true, "time": 0.14, "memory": 14320.0, "status": "done"}, {"code": "n,k = map(int, input().split())\nab = sorted([list(map(int, input().split())) for _ in range(n)])\ncnt = 0\nfor a,b in ab:\n    cnt += b\n    if cnt >= k: break\nprint(a)", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "n, k = list(map(int, input().split()))\nar = {}\nfor i in range(n):\n    a, b = list(map(int, input().split()))\n    if (a in ar) == True:\n        ar[a] += b\n    else:\n        ar[a] = b\n\nfor i in sorted(ar.keys()):\n    k -= ar[i]\n    if k <= 0:\n        print(i)\n        break\n", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "N,K=map(int,input().split())\nA={}\nfor i in range(N):\n  a,b=map(int,input().split())\n  A[a]=A.get(a,0)+b\nA=sorted(A.items())\n\ncnt=0\nfor n,k in A:\n  cnt+=k\n  if cnt>=K:\n    print(n)\n    return", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "N,K=list(map(int,input().split()))\nA=[list(map(int,input().split())) for _ in range(N)]\nA=sorted(A, key=lambda x: x[0])\n\ncnt=0\nfor i in range(N):\n    a,b=A[i]\n    A[i][1]+=cnt\n    cnt=A[i][1]\n\nfor i in range(N):\n    a,b=A[i]\n    if K<=b:break\nprint(a)\n", "passed": true, "time": 0.14, "memory": 14052.0, "status": "done"}, {"code": "import bisect\n\nn,k=list(map(int,input().split()))\nhairetu=[0]*100001\n\nfor _ in range(n):\n    a,b=list(map(int,input().split()))\n    hairetu[a]+=b\n\nruiseki=[0]*100001\nfor i in range(1,100001):\n    ruiseki[i]=ruiseki[i-1]+hairetu[i]\n\nprint((bisect.bisect_left(ruiseki,k)))\n", "passed": true, "time": 0.17, "memory": 17660.0, "status": "done"}, {"code": "xx = []\nn, k = map(int, input().split())\nab = [list(map(int, input().split())) for i in range(n)]\nxx = sorted(ab, key= lambda x:x[0])\n\nans = 0\nfor i in range(n):\n  ans += xx[i][1]\n  if ans >=  k:\n    print(xx[i][0])\n    break", "passed": true, "time": 0.14, "memory": 14312.0, "status": "done"}, {"code": "from collections import Counter\n\nn, k = map(int, input().split())\n\nd = Counter()\nfor _ in range(n):\n    a, b = map(int, input().split())\n    d[a] += b\n\nx = sorted(d.items(), key=lambda x: x[0])\ncnt = 0\nfor a, b in x:\n    cnt += b\n    if cnt >= k:\n        print(a)\n        return", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "AMAX = 10**5\ncount = [0] * (AMAX + 1)\n\nN, K = map(int, input().split())\n\nfor _ in range(N):\n    a, b = map(int, input().split())\n    count[a] += b\n\nfor ans in range(AMAX + 1):\n    if K <= count[ans]:\n        print(ans)\n        break\n    K -= count[ans]", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}]