class Array
  def cumsum; s = 0; map{|k| s += k } 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

cnt = nil
sum_x = (sum_min .. sum_max).bsearch do |sum_x|
  cnt = 0
  a.each do |r|
    cnt += n - (a.bsearch_index{|l| sum_x < l + r } || n)
    break if cnt >= m
  end
  cnt < m
end
# p m
# p cnt
    counter = Array.new(10**5+2){ 0 }
cum_counter = Array.new(10**5+2){ 0 }

h = Hash.new(0)
a.each{|e| h[e] += 1 }
# h = a.tally
# h.default = 0
# p a.reverse.cumsum

(10**5).downto(0) do |i|
  counter[i] = h[i] + counter[i+1]
  cum_counter[i] = h[i] * i + cum_counter[i+1]
end
# p a
# p sum_x
sum_all = cum_counter[0]
# sum_all = a.sum
ans = 0
a.each do |r|
  
  if sum_x-r <= 0
    t = sum_all + n * r
  else
    t = cum_counter[sum_x-r] + counter[sum_x-r] * r
  end
  
  # p [r, sum_x-r, cum_counter[sum_x-r], counter[sum_x-r], t]
  
  ans += t 
  
end

ans -= sum_x * (cnt - m)

puts ans


# c = a.cumsum.unshift(0)
# s = c[-1]
# # p s
# ans = 0
# a.each do |r|
#   pos = a.bsearch_index{|l| sum_x < r + l } || n
#   # p ["pos:", pos]
#   cnt = n - pos
#   ans += cnt * r + (s - c[pos])
#   m -= cnt
# end

# ans += m * sum_x

# puts ans


