output_description: Print the maximum possible happiness after M handshakes.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
      A_1 A_2 ... A_N
attempt: # ----------- gcd ----------- #
  def gcd(x, y):
      k, l = x, y
      if y < 0:
          k, l = -k, -l
      while l:
          k, l = l, k % l
      return k
  
  
  # --------- IsPrime --------- #
  def IsPrime(n):
      if n == 1:
          return False
      p = 2
      while p * p <= n:
          if n % p == 0:
              return False
          p += 1
      return True
  
  
  # --- fraction calculator --- #
  def fracsum(f1, f2, sign=1):
      fs = [f1[0] * f2[1] + sign * f1[1] * f2[0], f1[1] * f2[1]]
      g = gcd(fs[0], fs[1])
      fs[0] //= g
      fs[1] //= g
      return fs
  
  
  def fracprod(f1, f2):
      fs = [f1[0] * f2[0], f1[1] * f2[1]]
      g = gcd(fs[0], fs[1])
      fs[0] //= g
      fs[1] //= g
      return fs
  
  
  # ------ factorization ------ #
  def factorization(n):
      D = {}
      a = n
      p = 2
      while a != 1:
          cnt = 0
          while a % p == 0:
              cnt += 1
              a //= p
          if cnt != 0:
              D[p] = cnt
          p += 1
          if p * p > n and a != 1:
              D[a] = 1
              break
      return D
  
  
  # --------------fact. calculator-------------- #
  mod = 0  # <-- input modulo
  maxf = 0  # <-- input factional limitation
  
  
  def doubling(n, m, modulo=0):
      y = 1
      base = n
      tmp = m
      while tmp:
          if tmp % 2 == 1:
              y *= base
              if modulo > 0:
                  y %= modulo
          base *= base
          if modulo > 0:
              base %= modulo
          tmp //= 2
      return y
  
  
  def Vanilla(D):
      F = [1]
      for i in D:
          mL = F[:]
          dp = i
          for j in range(D[i]):
              for k in mL:
                  F.append(dp * k)
              dp *= i
      return F
  
  
  def bic(n):
      cnt = 0
      while n % 2 == 0:
          cnt += 1
          n //= 2
      return cnt
  
  
  mod = 2013265921
  
  
  def inved(a, modulo=mod):
      x, y, u, v, k, l = 1, 0, 0, 1, a, modulo
      while l != 0:
          x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
          k, l = l, k % l
      return x % modulo
  
  
  """D = {i: [] for i in range(39, 40)}
  for i in range(39, 40):
      j = 1
      bas = 2**i
      while len(D[i]) < 1:
          if IsPrime(j*bas+1):
              D[i].append(j*bas+1)
          j += 2
  print(D)"""
  # mod = 40961
  # mod = 998244353, primod = 50475, invmod = 305218526
  mod = 2013265921  # 998244353 = 2^23 * (odd number)
  primod = 137
  """S = factorization(mod - 1)
  S = {2: S[2]}
  LL = Vanilla(S)
  print(LL)
  LL.sort(reverse=True)
  for i in range(1, 500):
      flg = (doubling(i, doubling(2, S[2]), mod) == 1)
      for j in range(1, len(LL)):
          flg *= (doubling(i, LL[j], mod) != 1)
      if flg:
          print(i)"""
  
  
  def powlimit(n):
      y = 1
      cnt = 0
      while y < n:
          y *= 2
          cnt += 1
      return y, cnt
  
  
  N, M = map(int, input().split())
  A = list(map(int, input().split()))
  mm = max(A)
  F = [0 for _ in range(mm + 1)]
  for i in range(N):
      F[A[i]] += 1
  """N = int(input())
  AB = [list(map(int, input().split())) for _ in range(N)]
  F = [0] + [AB[i][0] for i in range(N)]
  G = [0] + [AB[i][1] for i in range(N)]"""
  pl, c = powlimit(2 * mm + 2)
  # pl, c = powlimit(2*N+2)
  F = F[:] + [0] * (pl - mm - 1)
  prim = [doubling(primod, doubling(2, 27 - i), mod) for i in range(27)]
  invp = [inved(prim[i]) for i in range(27)]
  
  
  def NTT(f, n, cn, inverse=False):
      if n == 1:
          return f
      if n == 2:
          return [(f[0] + f[1]) % mod, (f[0] - f[1]) % mod]
      dn = n // 2
      fe = [f[2 * i + 0] for i in range(dn)]
      fo = [f[2 * i + 1] for i in range(dn)]
      fe = NTT(fe, dn, cn - 1, inverse)
      fo = NTT(fo, dn, cn - 1, inverse)
      seed = inverse * prim[cn] + (1 - inverse) * invp[cn]
      grow = 1
      for i in range(dn):
          right = fo[i] * grow % mod
          f[i + 0 * dn] = (fe[i] + right) % mod
          f[i + 1 * dn] = (fe[i] - right) % mod
          grow *= seed
          grow %= mod
      return f
  
  
  X = NTT(F, pl, c)
  # Y = NTT(G, pl, c)
  # print(X)
  # print(Y)
  Z = [X[i] * X[i] % mod for i in range(pl)]
  Z = NTT(Z, pl, c, 1)
  # print(NTT(Z, pl, c, 1))
  ipl = inved(pl)
  for i in range(pl):
      Z[i] *= ipl
      Z[i] %= mod
  S = 2 * max(A)
  hp = 0
  ccnt = 0
  while ccnt < M:
      if ccnt + Z[S] < M:
          ccnt += Z[S]
          hp += S * Z[S]
      else:
          hp += S * (M - ccnt)
          ccnt += M - ccnt
      S -= 1
  print(hp)
  # for i in range(1, max(A)+1):
  #    print(Z[i]*ipl%mod)
  
problem_description: Statement
  
  Takahashi has come to a party as a special guest. There are N ordinary guests
  at the party. The i-th ordinary guest has a _power_ of A_i.
  
  Takahashi has decided to perform M _handshakes_ to increase the _happiness_ of
  the party (let the current happiness be 0). A handshake will be performed as
  follows:
  
    * Takahashi chooses one (ordinary) guest x for his left hand and another guest y for his right hand (x and y can be the same).
    * Then, he shakes the left hand of Guest x and the right hand of Guest y simultaneously to increase the happiness by A_x+A_y.
  
  However, Takahashi should not perform the same handshake more than once.
  Formally, the following condition must hold:
  
    * Assume that, in the k-th handshake, Takahashi shakes the left hand of Guest x_k and the right hand of Guest y_k. Then, there is no pair p, q (1 \leq p < q \leq M) such that (x_p,y_p)=(x_q,y_q).
  
  What is the maximum possible happiness after M handshakes?
samples: [{"input": "5 3\n    10 14 19 34 33", "output": "202\n    \n\nLet us say that Takahashi performs the following handshakes:\n\n  * In the first handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 4.\n  * In the second handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 5.\n  * In the third handshake, Takahashi shakes the left hand of Guest 5 and the right hand of Guest 4.\n\nThen, we will have the happiness of (34+34)+(34+33)+(33+34)=202.\n\nWe cannot achieve the happiness of 203 or greater, so the answer is 202.\n\n* * *"}, {"input": "9 14\n    1 3 5 110 24 21 34 5 3", "output": "1837\n    \n\n* * *"}, {"input": "9 73\n    67597 52981 5828 66249 75177 64141 40773 79105 16076", "output": "8128170"}]