//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

mod fft{
///FFTを計算する
///
/// ar:実部
///
/// ai:虚部
///
/// inv:逆変換時はtrue
///
/// arとaiの要素数は同一である必要がある。
pub fn fft(ar: &mut Vec<f64>, ai: &mut Vec<f64>, inv: bool) {
    if ar.len() != ai.len() {
        panic!("ar.len()!=ai.len()");
    }

    let mut n = ar.len();
    //配列の要素数が2のべき乗でない場合は調整する
    while ar.len().count_ones() != 1 {
        n += 1;
        ar.push(0.0);
        ai.push(0.0);
    }

    let (mut wr, mut wi, mut xr, mut xi): (f64, f64, f64, f64);
    let w = if inv { -1.0 } else { 1.0 } * 2.0 * std::f64::consts::PI / (n as f64);

    let mut i = 0;
    for j in 1..n - 1 {
        let mut k = n >> 1;
        loop {
            i ^= k;
            if k <= i {
                break;
            }
            k >>= 1
        }

        if j < i {
            xr = ar[j];
            xi = ai[j];
            ar[j] = ar[i];
            ai[j] = ai[i];
            ar[i] = xr;
            ai[i] = xi;
        }
    }

    let mut mh = 1;
    loop {
        let m = mh << 1;
        if m > n {
            break;
        }
        let mut irev = 0;

        i = 0;
        while i < n {
            wr = (w * irev as f64).cos();
            wi = (w * irev as f64).sin();
            let mut k = n >> 2;
            loop {
                irev ^= k;
                if k <= irev {
                    break;
                }
                k >>= 1;
            }

            for j in i..mh + i {
                k = j + mh;
                xr = ar[j] - ar[k];
                xi = ai[j] - ai[k];
                ar[j] += ar[k];
                ai[j] += ai[k];
                ar[k] = wr * xr - wi * xi;
                ai[k] = wr * xi + wi * xr;
            }

            i += m;
        }
        mh = m;
    }
    if inv {
        for i in ar.iter_mut() {
            *i /= n as f64;
        }
        for i in ai.iter_mut() {
            *i /= n as f64;
        }
    }
}

}

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

use fft::*;

fn main() {
    input! {
        n:usize,
        mut m:usize,
        a:[usize;n],
    }
    let mut va = vec![0.0; 200001];
    let mut vb = vec![0.0; 200001];
    let mut vai = vec![0.0; 200001];
    let mut vbi = vec![0.0; 200001];
    for &i in &a {
        va[i] += 1.0;
        vb[i] += 1.0;
    }

    fft(&mut va, &mut vai, false);
    fft(&mut vb, &mut vbi, false);

    for i in 0..va.len() {
        let r = va[i] * vb[i] - vai[i] * vbi[i];
        let j = va[i] * vbi[i] + vb[i] * vai[i];
        va[i] = r;
        vai[i] = j;
    }
    fft(&mut va, &mut vai, true);
    let mut ans = 0_usize;
    for (i, x) in va.iter().enumerate().rev() {
        let x = (x + 0.1) as usize;
        if x <= m {
            ans += x * i;
            m -= x;
        } else {
            ans += m * i;
            m = 0;
        }
        if m == 0 {
            break;
        }
    }
    println!("{}", ans);
}



Measured memory_bytes: 12532