#!/usr/bin/env python3

import sys

INF = float("inf")





def main():

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

    A = list(map(int, input().split()))



    A.sort()



    # 負数、 0数、 正数

    neg, zero, pos = [], [], []

    for a in A:

        if a < 0:

            neg.append(a)

        elif a == 0:

            zero.append(a)

        else:

            pos.append(a)

    neg.sort()

    pos.sort()



    prod_neg = len(neg) * len(pos)

    prod_zero = len(zero) * (len(neg)+len(pos))+len(zero)*(len(zero)-1)//2

    prod_pos = len(neg)*(len(neg)-1)//2 + len(pos)*(len(pos)-1)//2

    # print(prod_neg, prod_zero, prod_pos)

    # print(prod_neg+prod_zero+prod_pos)

    # print(N*(N-1)//2)



    if prod_neg >= K:

        # 二分探索

        left = neg[0]*pos[-1]-1

        right = 0

        while right-left > 1:

            mid = (right + left)//2

            # しゃくとり法

            counter = 0

            ns, ps = 0, 0

            for ns in range(len(neg)):

                while ps < len(pos) and neg[ns]*pos[ps] > mid:

                    ps += 1

                if ps == len(pos):

                    break

                counter += len(pos)-ps

            # print("{} in [{}, {}]  => {}".format(mid, left, right, counter))

            if counter < K:

                left = mid

            else:

                right = mid

        print(right)

    elif prod_zero + prod_neg >= K:

        print((0))

    else:

        neg.sort(reverse=True)

        # 二分探索

        left = 0

        right = 0

        if len(neg) > 0:

            right = max(neg[-1]**2, right)

        if len(pos) > 0:

            right = max(pos[-1]**2, right)

        right += 1

        while right - left > 1:

            mid = (left + right)//2

            # しゃくとり法

            counter = 0

            start, end = 0, len(pos)-1

            # print("{} in [{}, {}]".format(mid, left, right))

            for start in range(len(pos)):

                while end >= start and pos[start]*pos[end] >= mid:

                    end -= 1

                if end <= start:

                    break

                counter += end-start

                # print("addA: ", end-start)

            start, end = 0, len(neg)-1

            for start in range(len(neg)):

                while end >= start and neg[start]*neg[end] >= mid:

                    end -= 1

                if end <= start:

                    break

                counter += end-start

                # print("addB: ", end-start)

            # print("counter: {}".format(counter))

            if counter < K-prod_neg-prod_zero:

                left = mid

            else:

                right = mid

        print(left)





if __name__ == '__main__':

    main()

import sys





def main():

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

    A = list(map(int, input().split()))



    A.sort()



    # 負数、 0数、 正数

    neg, zero, pos = [], [], []

    for a in A:

        if a < 0:

            neg.append(a)

        elif a == 0:

            zero.append(a)

        else:

            pos.append(a)



    prod_neg = len(neg) * len(pos)

    prod_zero = len(zero) * (len(neg)+len(pos))+len(zero)*(len(zero)-1)//2

    prod_pos = len(neg)*(len(neg)-1)//2 + len(pos)*(len(pos)-1)//2



    if prod_neg >= K:

        # 二分探索

        left = neg[0]*pos[-1]-1

        right = 0

        while right-left > 1:

            mid = (right + left)//2

            # しゃくとり法

            counter = 0

            ps = 0

            for ns in range(len(neg)):

                while ps < len(pos) and neg[ns]*pos[ps] > mid:

                    ps += 1

                if ps == len(pos):

                    break

                counter += len(pos)-ps

            if counter < K:

                left = mid

            else:

                right = mid

        print(right)

    elif prod_zero + prod_neg >= K:

        print((0))

    else:

        # 二分探索

        left = 0

        right = 0

        if len(neg) > 0:

            right = max(neg[0]**2, right)

        if len(pos) > 0:

            right = max(pos[-1]**2, right)

        while right - left > 1:

            mid = (left + right)//2

            # しゃくとり法

            counter = 0

            end = len(pos)-1

            for start in range(len(pos)):

                while end >= start and pos[start]*pos[end] >= mid:

                    end -= 1

                if end <= start:

                    break

                counter += end-start

            start = 0

            for end in range(len(neg)-1, -1, -1):

                while end >= start and neg[start]*neg[end] >= mid:

                    start += 1

                if end <= start:

                    break

                counter += end-start

            if counter < K-prod_neg-prod_zero:

                left = mid

            else:

                right = mid

        print(left)





if __name__ == '__main__':

    main()

#!/usr/bin/env python3
import sys

INF = float("inf")


def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    A.sort()
    # 負数、 0数、 正数
    neg, zero, pos = [], [], []
    for a in A:
        if a < 0:
            neg.append(a)
        elif a == 0:
            zero.append(a)
        else:
            pos.append(a)
    neg.sort()
    pos.sort()
    prod_neg = len(neg) * len(pos)
    prod_zero = len(zero) * (len(neg) + len(pos)) + len(zero) * (len(zero) - 1) // 2
    prod_pos = len(neg) * (len(neg) - 1) // 2 + len(pos) * (len(pos) - 1) // 2
    # print(prod_neg, prod_zero, prod_pos)
    # print(prod_neg+prod_zero+prod_pos)
    # print(N*(N-1)//2)
    if prod_neg >= K:
        # 二分探索
        left = neg[0] * pos[-1] - 1
        right = 0
        while right - left > 1:
            mid = (right + left) // 2
            # しゃくとり法
            counter = 0
            ns, ps = 0, 0
            for ns in range(len(neg)):
                while ps < len(pos) and neg[ns] * pos[ps] > mid:
                    ps += 1
                if ps == len(pos):
                    break
                counter += len(pos) - ps
            # print("{} in [{}, {}]  => {}".format(mid, left, right, counter))
            if counter < K:
                left = mid
            else:
                right = mid
        print(right)
    elif prod_zero + prod_neg >= K:
        print((0))
    else:
        neg.sort(reverse=True)
        # 二分探索
        left = 0
        right = 0
        if len(neg) > 0:
            right = max(neg[-1] ** 2, right)
        if len(pos) > 0:
            right = max(pos[-1] ** 2, right)
        right += 1
        while right - left > 1:
            mid = (left + right) // 2
            # しゃくとり法
            counter = 0
            start, end = 0, len(pos) - 1
            # print("{} in [{}, {}]".format(mid, left, right))
            for start in range(len(pos)):
                while end >= start and pos[start] * pos[end] >= mid:
                    end -= 1
                if end <= start:
                    break
                counter += end - start
                # print("addA: ", end-start)
            start, end = 0, len(neg) - 1
            for start in range(len(neg)):
                while end >= start and neg[start] * neg[end] >= mid:
                    end -= 1
                if end <= start:
                    break
                counter += end - start
                # print("addB: ", end-start)
            # print("counter: {}".format(counter))
            if counter < K - prod_neg - prod_zero:
                left = mid
            else:
                right = mid
        print(left)


if __name__ == "__main__":
    main()

import sys


def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    A.sort()
    # 負数、 0数、 正数
    neg, zero, pos = [], [], []
    for a in A:
        if a < 0:
            neg.append(a)
        elif a == 0:
            zero.append(a)
        else:
            pos.append(a)
    prod_neg = len(neg) * len(pos)
    prod_zero = len(zero) * (len(neg) + len(pos)) + len(zero) * (len(zero) - 1) // 2
    prod_pos = len(neg) * (len(neg) - 1) // 2 + len(pos) * (len(pos) - 1) // 2
    if prod_neg >= K:
        # 二分探索
        left = neg[0] * pos[-1] - 1
        right = 0
        while right - left > 1:
            mid = (right + left) // 2
            # しゃくとり法
            counter = 0
            ps = 0
            for ns in range(len(neg)):
                while ps < len(pos) and neg[ns] * pos[ps] > mid:
                    ps += 1
                if ps == len(pos):
                    break
                counter += len(pos) - ps
            if counter < K:
                left = mid
            else:
                right = mid
        print(right)
    elif prod_zero + prod_neg >= K:
        print((0))
    else:
        # 二分探索
        left = 0
        right = 0
        if len(neg) > 0:
            right = max(neg[0] ** 2, right)
        if len(pos) > 0:
            right = max(pos[-1] ** 2, right)
        while right - left > 1:
            mid = (left + right) // 2
            # しゃくとり法
            counter = 0
            end = len(pos) - 1
            for start in range(len(pos)):
                while end >= start and pos[start] * pos[end] >= mid:
                    end -= 1
                if end <= start:
                    break
                counter += end - start
            start = 0
            for end in range(len(neg) - 1, -1, -1):
                while end >= start and neg[start] * neg[end] >= mid:
                    start += 1
                if end <= start:
                    break
                counter += end - start
            if counter < K - prod_neg - prod_zero:
                left = mid
            else:
                right = mid
        print(left)


if __name__ == "__main__":
    main()

-#!/usr/bin/env python3 - -INF = float("inf") -    neg.sort() -    pos.sort() -    # print(prod_neg, prod_zero, prod_pos) -    # print(prod_neg+prod_zero+prod_pos) -    # print(N*(N-1)//2) -            ns, ps = 0, 0 +            ps = 0 -            # print("{} in [{}, {}]  => {}".format(mid, left, right, counter)) -        neg.sort(reverse=True) -            right = max(neg[-1] ** 2, right) +            right = max(neg[0] ** 2, right) -        right += 1 -            start, end = 0, len(pos) - 1 -            # print("{} in [{}, {}]".format(mid, left, right)) +            end = len(pos) - 1 -                # print("addA: ", end-start) -            start, end = 0, len(neg) - 1 -            for start in range(len(neg)): +            start = 0 +            for end in range(len(neg) - 1, -1, -1): -                    end -= 1 +                    start += 1 -                # print("addB: ", end-start) -            # print("counter: {}".format(counter))