Buggy python submission (verdict: Time Limit Exceeded):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
A = LIST()
A.sort()
plus = 0
minus = 0
zero = 0
plus_lis = []
minus_lis = []

for n in A:
	if n == 0:
		zero += 1
	elif n > 0:
		plus += 1
		plus_lis.append(n)
	else:
		minus += 1
		minus_lis.append(n)

plus, minus, zero = plus*(plus-1)//2+minus*(minus-1)//2, plus*minus, plus*zero+minus*zero+zero*(zero-1)//2

if K <= minus:  # 答えは負
	l = -10**18-1
	r = 0

	def count(x):  # xより小さいペアの数を返す
		total = 0
		idx = 0
		for i in range(len(plus_lis)):
			while idx < len(minus_lis):
				if plus_lis[i] * minus_lis[idx] < x:
					idx += 1
				else:
					total += idx
					break
			else:
				total += idx

		return total

	while l+1 != r:
		m = (l+r)//2
		if count(m) >= K:
			r = m
		else:
			l = m
	print(l)

elif minus <= K <= minus+zero:
	print(0)

else:  # 答えは正
	l = 0
	r = 10**18+1

	def count(x):  # xより小さいペアの数を返す
		total = minus+zero
		tmp = 0
		idx = 0

		### プラスとマイナスを別々に数え上げる
		for i in range(len(plus_lis))[::-1]:
			while idx < len(plus_lis):
				if plus_lis[i] * plus_lis[idx] < x:
					idx += 1
				else:
					tmp += idx
					break
			else:
				tmp += idx
			if plus_lis[i] * plus_lis[i] < x: tmp -= 1  # 重複してる分引く
		tmp //= 2
		total += tmp
		tmp = 0
		idx = 0 
		for i in range(len(minus_lis)):
			while idx < len(minus_lis):
				if minus_lis[i] * minus_lis[-idx-1] < x:
					idx += 1
				else:
					tmp += idx
					break
			else:
				tmp += idx
			if minus_lis[i] * minus_lis[i] < x: tmp -= 1
		tmp //= 2
		total += tmp

		return total

	while l+1 != r:
		m = (l+r)//2
		if count(m) >= K:
			r = m
		else:
			l = m
	print(l)


Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
A = LIST()
A.sort()
plus = 0
minus = 0
zero = 0
plus_lis = []
minus_lis = []

for n in A:
	if n == 0:
		zero += 1
	elif n > 0:
		plus += 1
		plus_lis.append(n)
	else:
		minus += 1
		minus_lis.append(n)

plus, minus, zero = plus*(plus-1)//2+minus*(minus-1)//2, plus*minus, plus*zero+minus*zero+zero*(zero-1)//2

if K <= minus:  # 答えは負
	l = -10**18-1
	r = 0

	def count(x):  # xより小さいペアの数を返す
		total = 0
		idx = 0
		for i in range(len(plus_lis)):
			while idx < len(minus_lis):
				if plus_lis[i] * minus_lis[idx] < x:
					idx += 1
				else:
					total += idx
					break
			else:
				total += idx

		return total

	while l+1 != r:
		m = (l+r)//2
		if count(m) >= K:
			r = m
		else:
			l = m
	print(l)

elif minus <= K <= minus+zero:
	print(0)

else:  # 答えは正
	l = 0
	r = 10**18+1

	def count(x):  # xより小さいペアの数を返す
		total = minus+zero
		tmp = 0
		idx = 0

		### プラスとマイナスを別々に数え上げる
		for i in range(len(plus_lis))[::-1]:
			while idx < len(plus_lis):
				if plus_lis[i] * plus_lis[idx] < x:
					idx += 1
				else:
					tmp += idx
					break
			else:
				tmp += idx
			if plus_lis[i] * plus_lis[i] < x: tmp -= 1  # 重複してる分引く
		tmp //= 2
		total += tmp
		tmp = 0
		idx = 0 
		for i in range(len(minus_lis)):
			while idx < len(minus_lis):
				if minus_lis[i] * minus_lis[-idx-1] < x:
					idx += 1
				else:
					tmp += idx
					break
			else:
				tmp += idx
			if minus_lis[i] * minus_lis[i] < x: tmp -= 1
		tmp //= 2
		total += tmp

		return total

	while l+1 != r:
		m = (l+r)//2
		if count(m) >= K:
			r = m
		else:
			l = m
	print(l)