Problem:
Score: 400 points

Problem Statement

We have N integers A_1, A_2, ..., A_N.

There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?

Constraints

All values in input are integers.

2 \leq N \leq 2 \times 10^5

1 \leq K \leq \frac{N(N-1)}{2}

-10^9 \leq A_i \leq 10^9\ (1 \leq i \leq N)

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 \dots A_N

Output

Print the answer.

Sample Input 1

4 3
3 3 -4 -2

Sample Output 1

-6

There are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.

Sorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.

Sample Input 2

10 40
5 4 3 2 -1 0 0 0 0 0

Sample Output 2

6

Sample Input 3

30 413
-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0

Sample Output 3

448283280358331064

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include<bits/stdc++.h>
using namespace std;
namespace io{
    const int l=1<<20;
    char buf[l],*s,*t,c;
    inline void gc(){
        if(s==t){
            t=(s=buf)+fread(buf,1,l,stdin);
            c=s==t?EOF:*s++;
        }else c=*s++;
    }
    template<class IT>inline void gi(IT &x){
        x=0;gc();while(c<'0'||c>'9')gc();
        while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);gc();}
    }
    char buf0[20];int a;
    template<class IT>inline void pi(IT x){
        if(x<0){putchar('-');x=-x;}
        do buf0[++a]=x%10+48;while(x/=10);
        while(a)putchar(buf0[a--]);
        putchar('\n');
    }
};
using io::gi;
using io::pi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=200005;
ll a[N],b[N],z;int A,B;
inline ll C2(int x){return ((ll)x)*(x-1);}
ll solve(ll m){
	int i;
	if(m<0ll){
		ll s=0ll;
		m=-(m+1ll);
		rep(i,1,A)s+=(b+B+1)-upper_bound(b+1,b+B+1,m/a[i]);
		return s;
	}else{
		ll s=0ll;
		rep(i,1,B)s+=upper_bound(b+1,b+B+1,m/b[i])-(b+1);
		rep(i,1,A)s+=upper_bound(a+1,a+A+1,m/a[i])-(a+1);
		rep(i,1,A)if(a[i]*a[i]<=m)--s;
		rep(i,1,B)if(b[i]*b[i]<=m)--s;
		//printf("solve m=%lld s=%lld z=%lld\n",m,s,z);
		return (s>>1)+z;
	}
}
int main(){
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n;ll x,cn,k,l=-1000000000000000000ll,r=1000000000000000000ll,m,s;
    scanf("%d%lld",&n,&k);cn=C2(n);
    while(n--){
		scanf("%lld",&x);
		if(x){
			if(x>0)a[++A]=x;
			else b[++B]=-x;
		}
	}
	//printf("%lld - %lld - %lld\n",cn,C2(A),C2(B));
	z=(cn-(C2(A)+C2(B)))>>1;
	sort(a+1,a+A+1);
	sort(b+1,b+B+1);
	while(l<=r){
		m=(l+r)>>1;
		if(solve(m)<k)l=m+1ll;
		else r=(s=m)-1ll;
	}
	printf("%lld",s);
    return 0;
}