#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

namespace FastFourierTransform {
    using Real = double;
    struct C {
        Real x, y;

        C() : x(0), y(0) {}
        C(Real x) : x(x), y(0) {}
        C(Real x, Real y) : x(x), y(y) {}

        inline C operator+(const C &c) const { return C(x + c.x, y + c.y); }
        inline C operator-(const C &c) const { return C(x - c.x, y - c.y); }
        inline C operator*(const C &c) const { return C(x * c.x - y * c.y, x * c.y + y * c.x); }
        inline C operator/(const int a) const { return C(x/a, y/a);}
        inline C conj() const { return C(x, -y); }
    };
    using Complex = C;

    vector<Complex> DFT(const vector<Complex> &A) {
        int N = A.size();
        if (N==1) return A;

        vector<Complex> even(N/2), odd(N/2);

        for (int i = 0; i < N/2; ++i) {
            even[i] = A[i<<1|0];
            odd[i] = A[i<<1|1];
        }

        auto inversed_even = DFT(even);
        auto inversed_odd = DFT(odd);

        vector<Complex> ret(N);
        for (int i = 0; i < N; ++i) {
            Complex z = Complex(cos(2*PI*i/N),sin(2*PI*i/N));
            ret[i] = inversed_even[i%(N/2)] + z * inversed_odd[i%(N/2)];
        }

        return ret;
    }

    vector<Complex> IDFT(vector<Complex> &A) {
        int N = A.size();

        auto arranged = DFT(A);

        vector<Complex> ret(N);
        for (int i = 0; i < N; ++i) ret[i] = arranged[(N-i)%N] / N;

        return ret;
    }

    vector<long long> multiply(const vector<int> &A,const vector<int> &B) {
        int sz = (int)A.size() + (int)B.size() - 1;
        int N = 1; while (N < sz) N *= 2;
        vector<Complex> fA(N), fB(N);
        for (int i = 0; i < A.size(); ++i) fA[i] = A[i];
        for (int i = 0; i < B.size(); ++i) fB[i] = B[i];

        fA = DFT(fA);
        fB = DFT(fB);

        vector<Complex> C(N);
        for (int i = 0; i < N; ++i) C[i] = fA[i]*fB[i];
        C = IDFT(C);
        vector<long long> ret(N);
        for (int i = 0; i < N; ++i) ret[i] = (C[i].x+.1);

        return ret;
    }
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll N, M; cin >> N >> M;
    vector<int> A(100001);
    rep(i,N) {
        int a; cin >> a;
        A[a]++;
    }

    auto B = FastFourierTransform::multiply(A,A);
    int K = B.size();
    ll ans = 0;
    for (int i = K-1; i >= 0; --i) {
        if (M <= B[i]) {
            ans += M*i;
            break;
        }
        ans += B[i]*i;
        M -= B[i];
    }

    cout << ans << ln;
}


Measured memory_bytes: 27252