// Template
#include <bits/stdc++.h>
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, r) for (int i = (l); i < (r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T& x, const T& y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T& x, const T& y) {if (x < y) {x = y; return 1;} return 0;}
struct IOSET {IOSET() {cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10);}} ioset;

// Main
// Number-Theoretical Transform
// for example, (998244353, 31, 23), (1012924417, 198, 21), (1811939329, 136, 26)
template <int mod, int base, int max_exponents>
struct NumberTheoreticalTransform {
    vector<ll> bases, inv_bases;
    NumberTheoreticalTransform() {
        bases.resize(max_exponents + 1);
        inv_bases.resize(max_exponents + 1);
        bases[max_exponents] = base;
        inv_bases[max_exponents] = mod_pow(base, mod - 2);
        for (int i = max_exponents - 1; i >= 0; --i) {
            bases[i] = bases[i + 1] * bases[i + 1] % mod;
            inv_bases[i] = inv_bases[i + 1] * inv_bases[i + 1] % mod;
        }
    }
    ll mod_pow(ll x, ll y) {
        ll res = 1;
        while (y) {
            if (y & 1) res = res * x % mod;
            y >>= 1;
            x = x * x % mod;
        }
        return res;
    }
    void dft(vector<ll>& func, int exponents, int inv) {
        int siz = 1 << exponents;
        if (siz == 1) return;
        vector<ll> veca, vecb;
        for (int i = 0; i < siz / 2; ++i) {
            veca.push_back(func[2 * i]);
            vecb.push_back(func[2 * i + 1]);
        }
        dft(veca, exponents - 1, inv);
        dft(vecb, exponents - 1, inv);
        ll now = 1, zeta = bases[exponents];
        if (inv == -1) zeta = inv_bases[exponents];
        for (int i = 0; i < siz / 2; ++i) {
            func[i] = veca[i] + now * vecb[i] % mod;
            if (func[i] >= mod) func[i] -= mod;
            now = now * zeta % mod;
        }
        for (int i = siz / 2; i < siz; ++i) {
            func[i] = veca[i - siz / 2] + now * vecb[i - siz / 2] % mod;
            if (func[i] >= mod) func[i] -= mod;
            now = now * zeta % mod;
        }
    }
    vector<ll> multiply(vector<ll> f, vector<ll> g) {
        int siz = 1, exp = 0;
        while (siz < f.size() + g.size()) {
            siz *= 2;
            ++exp;
        }
        vector<ll> nf(siz, 0), ng(siz, 0);
        for (int i = 0; i < f.size(); ++i) nf[i] = f[i];
        for (int i = 0; i < g.size(); ++i) ng[i] = g[i];
        dft(nf, exp, 1);
        dft(ng, exp, 1);
        for (int i = 0; i < siz; ++i) nf[i] = nf[i] * ng[i] % mod;
        dft(nf, exp, -1);
        ll inv = mod_pow(siz, mod - 2);
        for (int i = 0; i < siz; ++i) nf[i] = nf[i] * inv % mod;
        return nf;
    }
};

int main() {
    constexpr int MAX_A = 100000;
    NumberTheoreticalTransform<998244353, 31, 23> ntt1;
    NumberTheoreticalTransform<1012924417, 198, 21> ntt2;
    
    int n; ll m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    
    vector<ll> cnt(MAX_A + 1, 0);
    rep(i, n) ++cnt[a[i]];
    vector<ll> mul1 = ntt1.multiply(cnt, cnt), mul2 = ntt2.multiply(cnt, cnt);
    vector<ll> mul(2 * MAX_A + 1);
    rep(i, 2 * MAX_A + 1) {
        ll t = mul2[i] - mul1[i];
        if (t < 0) t += 1012924417;
        t *= ntt2.mod_pow(998244353, 1012924415);
        t %= 1012924417;
        mul[i] = mul1[i] + 998244353 * t;
    }
    
    ll ans = 0;
    for (int i = MAX_A * 2; i >= 0; --i) {
        ans += i * min(m, mul[i]);
        m -= min(m, mul[i]);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 16160