@n, m = gets.split.map(&:to_i)
@a = gets.split.map(&:to_i)
@a.sort!
@s = Array.new(@n+1, 0)
@n.times{|i| @s[i+1] = @s[i]+@a[i] }
def lower_bound(v)
  l = -1
  r = @a.length
  while l+1 < r
    c = (l+r)>>1
    (@a[c] >= v) ? (r = c) : (l = c)
  end
  r
end
def calc(x)
  tot = 0
  num = 0
  @n.times{|i|
    j = lower_bound(x-@a[i])
    num += @n-j
    tot += @s[@n]-@s[j]
    tot += @a[i]*(@n-j)
  }
  [tot, num]
end
l = 0
r = 200005
while l+1 < r
  c = (l+r)>>1
  (calc(c)[1] >= m) ? (l = c) : (r = c)
end
p = calc(l)
ans = p[0]
ans -= (p[1]-m)*l
p ans