#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
 
using namespace std;
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 
 
 

int main()
{
    ll n,k;
    cin>>n;
    cin>>k;
    
        
    vector <ll> v(n);
    vector <ll> pos,neg,zero;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        if(v[i]>0)
            pos.push_back(v[i]);
        else if(v[i]==0)
            zero.push_back(v[i]);
        else
            neg.push_back(-v[i]);
    }
    sort(neg.begin(),neg.end());
    sort(pos.begin(),pos.end());
    ll posn=pos.size();ll negn=neg.size();

    ll neg_count=pos.size()*neg.size();
    ll zero_count=zero.size()*(pos.size()+neg.size())+(zero.size()*(zero.size()-1))/2;
    ll pos_count=(pos.size()*(pos.size()-1))/2+(neg.size()*(neg.size()-1))/2;
    ll test=0;
    if(k<=neg_count)
    {
        ll l=0,r=1e18;
        while(l<=r)
        {
            ll mid=(l+r)/2;
            int i=0;int j=negn-1;
            ll count1=0;
            while(i<posn&&j>=0)
            {
                if(pos[i]*neg[j]>=mid)
                {
                    count1+=(posn-i);
                    j--;
                }
                else
                    i++;
            }
            i=0;j=negn-1;
            ll count2=0;
            while(i<posn&&j>=0)
            {
                if(pos[i]*neg[j]>mid)
                {
                    count2+=(posn-i);
                    j--;
                }
                else
                    i++;
            }
            //cout<<l<<" "<<r<<" "<<mid<<" "<<count<<endl;
            if(count2>=k)
                l=mid+1;
            else if(count1<k)
                r=mid-1;
            else
            {
                test=-mid;
                l=mid+1;
            }

        }
    }
    else if(k<=neg_count+zero_count)
        test=0;
    else{
        ll l=0,r=1e18;
        while(l<=r)
        {
            ll mid=(l+r)/2;
            int i=0;int j=posn-1;
            ll count=0;
            while(i<j)
            {
                if(pos[i]*pos[j]>=mid)
                {
                    count+=(j-i);
                    j--;
                }
                else
                    i++;
            }
            i=0;j=posn-1;
            ll count2=0;
            while(i<j)
            {
                if(pos[i]*pos[j]>mid)
                {
                    count2+=(j-i);
                    j--;
                }
                else
                    i++;
            }
            i=0;j=negn-1;
            while(i<j)
            {
                if(neg[i]*neg[j]>=mid)
                {
                    count+=(j-i);
                    j--;
                }
                else
                    i++;
            }
            i=0;j=negn-1;
            while(i<j)
            {
                if(neg[i]*neg[j]>mid)
                {
                    count2+=(j-i);
                    j--;
                }
                else
                    i++;
            }
            //out<<l<<" "<<r<<" "<<mid<<" "<<count<<" "<<count2<<endl;
            if(count2>=(n*(n-1))/2-k+1)
                l=mid+1;
            else if(count<(n*(n-1))/2-k+1)
                r=mid-1;
            else
            {
                test=mid;
                l=mid+1;
            }

        }
    }
    cout<<test<<endl;


    return 0;   
}
 
 

Measured memory_bytes: 4084