Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N, K = map(int, input().split())
A = sorted(map(int, input().split()))
ok = -10**20  # There are <= K pairs <= ok
ng = 10**20   
# x, count

while ok + 1 < ng:
  x = (ok + ng) //2
  count = 0
  for i, a in enumerate(A):
    if a > 0:
      j = bisect.bisect_right(A, x // a)
      if i < j:
        count += j - 1
      else:
        count += j
    elif a < 0:
      j = bisect.bisect_left(A, - (-x // a))
      #print(x, a, -(-x//a), j)
      if i >= j:
        count += N - j - 1
      else:
        count += N - j
    else: # a == 0
      if x >= 0:
        count += N-1
    #print(x, a, count)
  count //= 2
  #print(x, count)
  if count < K:
    ok = x
  else:
    ng = x
  
  
print(ng)


Fixed submission:
def main(N, K, A):
  cp = 0
  cn = 0
  cz = 0
  An = []
  Anp = []
  Ap = []
  for a in A:
    cp += a > 0
    cn += a < 0
    cz += a == 0
    if a > 0:
      Ap.append(a)
    if a < 0:
      An.append(a)
      Anp.append(-a)
  Anp = sorted(Anp)
	
  if K <= cn * cp:
    # negative 
    #print(K)
    
    ok = -10**20  # There are <= K pairs <= ok
    ng = 0
    # x, count

    while ok + 1 < ng:
      x = (ok + ng) //2
      count = 0
      i_an = -1
      for i, a in enumerate(Ap): # a: increasing -> x // a increasing
        while i_an + 1 < len(An) and An[i_an + 1]* a <= x:
          i_an += 1

        count += i_an + 1
        #print(x, a, count)
      #print(x, count)
      if count < K:
        ok = x
      else:
        ng = x
    return ng
  elif K <= cn * cp + cz * (cp + cn) + (cz - 1 )* cz //2:
    
    return 0
  else:
    # positive
    #print(K)
    K -=  cn * cp + cz * (cp + cn) + (cz - 1 )* cz //2
    #print(K)
    ok = 0
    ng = 10**20  # There are <= K pairs <= ok
    # x, count

    while ok + 1 < ng:
      x = (ok + ng) //2
      count = 0
      for Aa in [Ap, Anp]:
        i_ap = -1
        for i, a in zip(range(len(Aa)-1, -1, -1), Aa[::-1]):
          # a: decreasing -> x // a increasing
          while i_ap+1 < len(Aa) and Aa[i_ap+1] * a <= x:
            i_ap += 1
          count += i_ap + 1
          count -= i <= i_ap
          #print(x, a, count, i, i_ap, Aa)
      count //= 2
      #print(x, count)
      if count < K:
        ok = x
      else:
        ng = x
    return ng

N, K = map(int, input().split())
A = sorted(map(int, input().split()))
print(main(N,K,A))
#pairs = []
#for i in range(len(A)):
#  for j in range(i + 1, len(A)):
#    pairs.append(A[i]*A[j])
#pairs.sort()
#for K, p in zip(range(1, N*(N+1)//2+1), pairs):
#  
#  result = main(N, K, A)
#  if result != p:
#    print(K, p, result)
#print('done')

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N, K = map(int, input().split())
A = sorted(map(int, input().split()))
ok = -10**20  # There are <= K pairs <= ok
ng = 10**20   
# x, count

while ok + 1 < ng:
  x = (ok + ng) //2
  count = 0
  for i, a in enumerate(A):
    if a > 0:
      j = bisect.bisect_right(A, x // a)
      if i < j:
        count += j - 1
      else:
        count += j
    elif a < 0:
      j = bisect.bisect_left(A, - (-x // a))
      #print(x, a, -(-x//a), j)
      if i >= j:
        count += N - j - 1
      else:
        count += N - j
    else: # a == 0
      if x >= 0:
        count += N-1
    #print(x, a, count)
  count //= 2
  #print(x, count)
  if count < K:
    ok = x
  else:
    ng = x
  
  
print(ng)

Fixed submission:
def main(N, K, A):
  cp = 0
  cn = 0
  cz = 0
  An = []
  Anp = []
  Ap = []
  for a in A:
    cp += a > 0
    cn += a < 0
    cz += a == 0
    if a > 0:
      Ap.append(a)
    if a < 0:
      An.append(a)
      Anp.append(-a)
  Anp = sorted(Anp)
	
  if K <= cn * cp:
    # negative 
    #print(K)
    
    ok = -10**20  # There are <= K pairs <= ok
    ng = 0
    # x, count

    while ok + 1 < ng:
      x = (ok + ng) //2
      count = 0
      i_an = -1
      for i, a in enumerate(Ap): # a: increasing -> x // a increasing
        while i_an + 1 < len(An) and An[i_an + 1]* a <= x:
          i_an += 1

        count += i_an + 1
        #print(x, a, count)
      #print(x, count)
      if count < K:
        ok = x
      else:
        ng = x
    return ng
  elif K <= cn * cp + cz * (cp + cn) + (cz - 1 )* cz //2:
    
    return 0
  else:
    # positive
    #print(K)
    K -=  cn * cp + cz * (cp + cn) + (cz - 1 )* cz //2
    #print(K)
    ok = 0
    ng = 10**20  # There are <= K pairs <= ok
    # x, count

    while ok + 1 < ng:
      x = (ok + ng) //2
      count = 0
      for Aa in [Ap, Anp]:
        i_ap = -1
        for i, a in zip(range(len(Aa)-1, -1, -1), Aa[::-1]):
          # a: decreasing -> x // a increasing
          while i_ap+1 < len(Aa) and Aa[i_ap+1] * a <= x:
            i_ap += 1
          count += i_ap + 1
          count -= i <= i_ap
          #print(x, a, count, i, i_ap, Aa)
      count //= 2
      #print(x, count)
      if count < K:
        ok = x
      else:
        ng = x
    return ng

N, K = map(int, input().split())
A = sorted(map(int, input().split()))
print(main(N,K,A))
#pairs = []
#for i in range(len(A)):
#  for j in range(i + 1, len(A)):
#    pairs.append(A[i]*A[j])
#pairs.sort()
#for K, p in zip(range(1, N*(N+1)//2+1), pairs):
#  
#  result = main(N, K, A)
#  if result != p:
#    print(K, p, result)
#print('done')