#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e16;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
vector<complex<double>> fft(vector<complex<double>> a,bool inverse = false) {
    int n = a.size();
    int h = 0;
    for (int i = 0; 1 << i < n; i++) h++;
    rep(i,n){
        int j = 0;
        rep(k,h) j |= (i >> k & 1) << (h - 1 - k);
        if (i < j) swap(a[i], a[j]);
    }
    for (int b = 1; b < n; b *= 2) {
        rep(j,b) {
            complex<double> w = polar(1.0,(2 * M_PI) / (2 * b) * j * (inverse ? 1 : -1));
            for (int k = 0; k < n; k += b * 2) {
                complex<double> s = a[j + k];         
                complex<double> t = a[j + k + b] * w; 
                a[j + k] = s + t;                     
                a[j + k + b] = s - t;                 
            }
        }
    }
    if (inverse){
        rep(i,n) a[i] /= n;
    }
    return a;
}
vector<complex<double>> fft(vector<double> a, bool inverse = false) {
    vector<complex<double>> a_complex(a.size());
    rep(i,a.size()) a_complex[i] = complex<double>(a[i], 0);
    return fft(a_complex, inverse);
}
vector<double> convolve(vector<double> a, vector<double> b) {
    int s = a.size() + b.size() - 1;
    int t = 1;
    while (t < s) t *= 2;
    a.resize(t);
    b.resize(t);
    vector<complex<double>> A = fft(a);
    vector<complex<double>> B = fft(b);
    for (int i = 0; i < t; i++) {
        A[i] *= B[i];
    }
    A = fft(A, true);
    a.resize(s);
    rep(i,s) a[i] = A[i].real();
    return a;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,k;
    cin >> n >> m;
    vector<double> a(100001,0);
    rep(i,n){
        cin >> k;
        a[k]++;
    }
    a = convolve(a,a);
    vector<ll> b(a.size());
    rep(i,a.size()) b[i] = a[i]+0.5;
    ll len = 0,ans = 0;
    for(int i = 200000;i >= 0;i--){
        ll c = b[i];
        if (len < m && m <= len+c){
            ans += i*(m-len);
            break;
        }
        len += c;
        ans += c*i;
    }
    PRINT(ans);
}    


Measured memory_bytes: 19544