Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    def test(x):
        tmp = [None] * n
        for i in range(n):
            if a[i] == 0:
                tmp[i] = (n - 1, 0, 0)
            else:
                tmp[i] = (x / a[i], -1 if a[i] < 0 else 1, a[i])
        print(tmp)
        res = []
        for t, flg, ai in tmp:
            if flg == 0:
                res.append(0 if x < 0 else t)
            else:
                if flg == -1:
                    res.append(n - bisect_left(a, t) - (ai >= t))
                else:
                    res.append(bisect_right(a, t) - (ai <= t))
        # print(res, sum(res))
        return
    def f(x):
        res = 0
        for ai in a:
            if ai == 0:
                res += 0 if x < 0 else n - 1
            else:
                if ai <= -1:
                    res -= ai * ai <= x
                    ok = n
                    ng = -1
                    while ok - ng > 1:
                        mid = (ok + ng) // 2
                        if a[mid] * ai <= x:
                            ok = mid
                        else:
                            ng = mid
                    res += n - ok
                else:
                    res -= ai * ai <= x
                    ok = -1
                    ng = n
                    while abs(ok - ng) > 1:
                        mid = (ok + ng) // 2
                        if a[mid] * ai <= x:
                            ok = mid
                        else:
                            ng = mid
                    res += ok + 1
        # print(res // 2,x,ok,ng)
        return k <= res // 2
    n, k = LI()
    a = LI()
    a.sort()
    # print(a)
    # test(448283280358331063)
    # test(448283280358331064)
    # return
    ok = 10 ** 18
    ng = -10 ** 18 - 1
    while ok - ng > 1:
        mid = (ok + ng) // 2
        # print(ok,ng,mid)
        if f(mid):
            ok = mid
        else:
            ng = mid
    print(ok)
    return


#main
if __name__ == '__main__':
    solve()


Fixed submission:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def f(x):
    cnt = 0
    if x < 0:
        j = p-1
        for i in range(m)[::-1]:
            while j >= 0 and plus[j]*minus[i] <= x:
                j -= 1
            cnt += p - j - 1
    else:
        j = 0
        for i in range(m)[::-1]:
            while j < m and minus[j]*minus[i] > x:
                j += 1
            cnt += max(0,i-j)
        j = p-1
        for i in range(p):
            while j >= 0 and plus[j]*plus[i] > x:
                j -= 1
            cnt += max(0,j-i)
        cnt += zero*(zero-1)//2 + m*p + zero*(m+p)
    
    return cnt >= k

n,k = LI()
a = LI()
a.sort()
minus = [x for x in a if x < 0]
plus = [x for x in a if x > 0]
m,p = len(minus),len(plus)
zero = bl(a,1) - br(a,-1)
ok,ng = 10**18,-10**18-1

while ok - ng > 1:
    mid = (ok+ng)//2
    if f(mid):
        ok = mid
    else:
        ng = mid
print(ok)