class Array
  def cumsum; s = 0; map{|k| s += k } end
  def fd(n=nil); n = self.max if n.nil?; res = Array.new(n+1,0);self.map{|e| res[e]+=1 };res;end
end

n, m = gets.to_s.split.map{|t|t.to_i}
a    = gets.to_s.split.map{|t|t.to_i}.sort

sum_min = a[0]  * 2
sum_max = a[-1] * 2

cfd = a.fd.reverse.cumsum.reverse
class << cfd
  def number_greater_than(x)
    return self[0] if x <= 0
    return 0 if  size <= x+1
    self[x+1]
  end
end

sum_x = (sum_min .. sum_max).bsearch do |sum_x|
  cnt = 0
  a.each do |r|
    cnt += cfd.number_greater_than(sum_x-r)
    break if cnt >= m
  end
  cnt < m
end

c = ([0] + a).cumsum
s = c[-1]

ans = 0
a.each do |r|
  pos = a.bsearch_index{|l| sum_x < r + l } || n
  cnt = n - pos
  ans += cnt * r + (s - c[pos])
  m -= cnt
end

ans += m * sum_x

puts ans