#include <bits/stdc++.h>
using namespace std;

template <unsigned Mod> struct ModularInt {
  using M = ModularInt;
  unsigned v;
  ModularInt(long long a = 0) : v((a %= Mod) < 0 ? a + Mod : a) {}
  M operator-() const { return M() -= *this; }
  M& operator*=(M r) { v = (uint64_t)v * r.v % Mod; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= Mod) v -= Mod; return *this; }
  M& operator-=(M r) { if ((v += Mod - r.v) >= Mod) v -= Mod; return *this; }
  friend M operator*(M l, M r) { return l *= r; }
  friend M operator/(M l, M r) { return l /= r; }
  friend M operator+(M l, M r) { return l += r; }
  friend M operator-(M l, M r) { return l -= r; }
  M pow(long long n) const {
    assert(n >= 0);
    M res = 1;
    for (M t = *this; n; t *= t, n >>= 1) if (n & 1) res *= t;
    return res;
  }
  M inv() const { assert(v != 0); return pow(Mod - 2); }
  friend string to_string(M a) { return to_string(a.v); }
};
constexpr unsigned mod0 = 998244353;
constexpr unsigned mod1 = 15 << 27 | 1;
using Mint0 = ModularInt<mod0>;
using Mint1 = ModularInt<mod1>;

template <unsigned Mod> void ntt(vector< ModularInt<Mod> >& a, bool inverse = false) {
  using Mint = ModularInt<Mod>;
  static Mint root = [] {
    for (Mint r = 2; ; ++r.v) if (r.pow((Mod - 1) / 2).v != 1) return r;
  }();
  static vector<Mint> dt(30), idt(30);
  if (dt[0].v == 0) for (int i = 0; i < 30; ++i)
    dt[i] = -root.pow((Mod - 1) >> (i + 2)), idt[i] = dt[i].inv();
  int n = a.size();
  assert(__builtin_popcount(n) == 1);
  if (not inverse) {
    for (int w = n; w >>= 1; ) {
      Mint t = 1;
      for (int s = 0, k = 0; s < n; s += 2 * w) {
        for (int i = s, j = s + w; i < s + w; ++i, ++j) {
          Mint x = a[i], y = a[j] * t;
          if (x.v >= Mod) x.v -= Mod;
          a[i].v = x.v + y.v, a[j].v = x.v + (Mod - y.v);
        }
        t *= dt[__builtin_ctz(++k)];
      }
    }
  } else {
    for (int w = 1; w < n; w *= 2) {
      Mint t = 1;
      for (int s = 0, k = 0; s < n; s += 2 * w) {
        for (int i = s, j = s + w; i < s + w; ++i, ++j) {
          Mint x = a[i], y = a[j];
          a[i] = x + y, a[j].v = x.v + (Mod - y.v), a[j] *= t;
        }
        t *= idt[__builtin_ctz(++k)];
      }
    }
  }
}
template <class Mint> vector<Mint> multiply(vector<Mint> a, vector<Mint> b) {
  if (a.empty() or b.empty()) return {};
  int n = a.size(), m = b.size(), l = n + m - 1, sz = 1 << __lg(2 * l - 1);
  if (min(n, m) < 30) {
    vector<long long> c(l);
    for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j)
      c[i + j] += (a[i] * b[j]).v;
    return {begin(c), end(c)};
  }
  a.resize(sz), ntt(a);
  b.resize(sz), ntt(b);
  for (int i = 0; i < sz; ++i) a[i] *= b[i];
  ntt(a, true), a.resize(l);
  Mint inv = Mint(sz).inv();
  for (auto&& e : a) e *= inv;
  return a;
}

using Z = long long;
Z tmod(Z a, Z b) { 
  if (b < 0) return -tmod(-a, -b);
  return (a %= b) < 0 ? a + b : a;
}
Z tdiv(Z a, Z b) { return (a - tmod(a, b)) / b; }
Z mod_inv(Z a, Z p) {
  a = tmod(a, p);
  Z b = p, x = 1, u = 0;
  while (b) {
    Z q = a / b;
    swap(a -= q * b, b);
    swap(x -= q * u, u);
  }
  return a == 1 ? tmod(x, p) : -1;
}

long long CRT(const vector<long long>& a, const vector<long long>& p) {
  int n = a.size();
  long long x = 0;
  vector<long long> y(n);
  long long prod = 1;
  for (int i = 0; i < n; ++i) {
    y[i] = tmod(a[i] - x, p[i]);
    for (int j = 0; j < i; ++j) {
      (y[i] *= mod_inv(p[j], p[i])) %= p[i];
    }
    x += prod * y[i];
    prod *= p[i];
  }
  return x;
}

vector<long long> multiply(vector<long long> a, vector<long long> b) {
  vector<Mint0> a0(begin(a), end(a)), b0(begin(b), end(b));
  vector<Mint1> a1(begin(a), end(a)), b1(begin(b), end(b));
  auto c0 = multiply(a0, b0);
  auto c1 = multiply(a1, b1);
  int l = c0.size();
  vector<long long> c(l);
  for (int i = 0; i < l; ++i) {
    c[i] = CRT({c0[i].v, c1[i].v}, {mod0, mod1});
  }
  return c;
}

constexpr int lim = 1e5;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  long long m;
  cin >> n >> m;
  vector<long long> a(lim + 1);
  while (n--) {
    int x;
    cin >> x;
    a[x] += 1;
  }
  a = multiply(a, a);
  long long res = 0;
  for (int x = 2 * lim; x; --x) {
    long long t = min<long long>(m, a[x]);
    m -= t;
    res += t * x;
  }
  cout << res << '\n';
}


Measured memory_bytes: 9580