#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: u32 = 1_000_000_007;
const INF: usize = std::usize::MAX/2;

pub trait SetMinMax {
	fn setmin(&mut self, v: Self) -> bool;
	fn setmax(&mut self, v: Self) -> bool;
}
impl<T> SetMinMax for T where T: PartialOrd {
	fn setmin(&mut self, v: T) -> bool {
		*self > v && { *self = v; true }
	}
	fn setmax(&mut self, v: T) -> bool {
		*self < v && { *self = v; true }
	}
}

// https://math314.hateblo.jp/entry/2015/05/07/014908
fn ntt(c: Vec<i64>, inv: bool, mo: i64, g: i64) -> Vec<i64>{
    let n = c.len();
    if n==1 {
        return c;
    }
    let c1: Vec<i64> = (0..n/2).map(|x| c[2*x]).collect();
	let c2: Vec<i64> = (0..n/2).map(|x| c[2*x+1]).collect();
	let r1 = ntt(c1, inv, mo, g);
    let r2 = ntt(c2, inv, mo, g);
    let mut ret = vec![0;n];
	let mut h = mod_pow(g,(mo-1)/(n as i64),mo);
	if inv {h = mod_inv(h,mo);}
	let mut base = 1;
    for i in 0..n {
		ret[i] = r1[i%(n/2)] + base * r2[i%(n/2)];
		ret[i] %= mo;
		base = base * h % mo;
    }
    ret
}

fn conv(mut a1: Vec<i64>, mut a2: Vec<i64>) -> Vec<i64> {
    let sz = a1.len()+a2.len();
    let mut n = 1;
	while sz>n {n*=2;}
	while a1.len()<n { a1.push(0);}
	while a2.len()<n { a2.push(0);}
	// https://www.cnblogs.com/Guess2/p/8422205.html
	let mo = 5767169;
	let g = 3;
	let f1 = ntt(a1.clone(),false,mo,g);
	let f2 = ntt(a2.clone(),false,mo,g);
	let c1: Vec<i64> = (0..n).map(|x| f1[x]*f2[x]%mo).collect();
	let ans = ntt(c1.clone(),true,mo,g);
	let A = ans.iter().map(|x| x*mod_inv(n as i64,mo)%mo).collect::<Vec<i64>>();

	let mo2 = 7340033;
	let g2 = 3;
	let f12 = ntt(a1.clone(),false,mo2,g2);
	let f22 = ntt(a2.clone(),false,mo2,g2);
	let c12: Vec<i64> = (0..n).map(|x| f12[x]*f22[x]%mo2).collect();
	let ans2 = ntt(c12.clone(),true,mo2,g2);
	let A2 = ans2.iter().map(|x| x*mod_inv(n as i64,mo2)%mo2).collect::<Vec<i64>>();

	let mut ret = vec![0;ans.len()];
	for i in 0..ans.len() {
		let p = mo * mo2;
		ret[i] = (A[i] + (A2[i]-A[i]+mo2) % mo2 * mod_inv(mo,mo2) % mo2 * mo % p) % p;
	}
	ret
}

fn mod_pow(mut a: i64, n: i64, mo: i64) -> i64{
	a %= mo;
	if a == 0 {
		return 0;
	}
	let mut lo = n;
	let mut ret = 1;
	let mut x = a;
	while lo > 0 {
		if lo % 2 == 1 {
			ret = ret * x % mo;
		}
		x = x * x % mo;
		lo /= 2;
	}
	ret
}

fn mod_inv(a: i64, mo: i64) -> i64{
	mod_pow(a,mo-2,mo)
}

fn solve() {
	let (n,m) = read!(usize,usize);
	let a = read!([usize]);
	let mut ma = 100000;
	let mut v = vec![0;ma+1];
	for i in 0..n {
		v[a[i]] += 1;
	}
	let ret = conv(v.clone(),v.clone());
	let mut ans = 0;
	let mut res = m as i64;
	for i in (0..2*ma+1).rev() {
		if ret[i]<=res {
			res -= ret[i];
			ans += ret[i]*(i as i64);
		}
		else{
			ans += res * (i as i64);
			break;
		}
	}
	println!("{}", ans);
}

fn run() {
    solve();
}

Measured memory_bytes: 41372