using System;
using CompLib.Algorithm;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        long m = sc.NextLong();
        int[] a = sc.IntArray();
        int max = -1;
        foreach (int i in a)
        {
            max = Math.Max(max, i);
        }

        long[] x = new long[max + 1];
        foreach (int i in a)
        {
            x[i]++;
        }

        var fft = FastFourierTransform.Convolution(x, x);
        long ans = 0;
        for (int i = max + max; i >= 0; i--)
        {
            if(m <= 0) break;
            long t = Math.Min(m, fft[i]);
            ans += i * t;
            m -= t;
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Algorithm
{
    using Mathematics;
    using System;
    using System.Numerics;

    public static class FastFourierTransform
    {
        private const int E = 26;
        public static readonly ModInt O = new ModInt(18769, 136);
        public static readonly ModInt InvO = new ModInt(137728885, 839354248);

        // Z[i] 1の原始2^i乗根
        public static readonly ModInt[] Z;
        public static readonly ModInt[] InvZ;

        static FastFourierTransform()
        {
            Z = new ModInt[E + 1];
            InvZ = new ModInt[E + 1];
            Z[E] = O; // ZE☆
            InvZ[E] = InvO;
            for (int i = E - 1; i >= 0; i--)
            {
                Z[i] = Z[i + 1] * Z[i + 1];
                InvZ[i] = InvZ[i + 1] * InvZ[i + 1];
            }
        }

        /// <summary>
        /// a,bからc[k]=Σ(a[i]*b[k-i])を求める
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long[] Convolution(long[] a, long[] b)
        {
            int len = 1;
            int l = 0;
            while (len < (a.Length + b.Length))
            {
                l++;
                len *= 2;
            }

            var mA = new ModInt[len];
            for (int i = 0; i < a.Length; i++)
            {
                mA[i] = a[i];
            }

            var mB = new ModInt[len];
            for (int i = 0; i < b.Length; i++)
            {
                mB[i] = b[i];
            }

            ModInt[] hatG = Transform(mA, l, false);
            ModInt[] hatH = Transform(mB, l, false);
            ModInt[] hatF = new ModInt[len];
            for (int i = 0; i < len; i++)
            {
                hatF[i] = hatG[i] * hatH[i];
            }

            ModInt[] nF = Transform(hatF, l, true);

            ModInt invLen = ModInt.Inverse(len);
            long[] f = new long[len];
            for (int i = 0; i < len; i++)
            {
                f[i] = (nF[i] * invLen).Num;
            }

            return f;
        }

        private static ModInt[] Transform(ModInt[] a, int l, bool inverse)
        {
            int len = 1 << l;
            if (len == 1)
            {
                return a;
            }

            ModInt[] a0 = new ModInt[len / 2];
            ModInt[] a1 = new ModInt[len / 2];

            for (int i = 0; i < len / 2; i++)
            {
                a0[i] = a[i * 2];
                a1[i] = a[i * 2 + 1];
            }

            ModInt[] hatF0 = Transform(a0, l - 1, inverse);
            ModInt[] hatF1 = Transform(a1, l - 1, inverse);

            ModInt zetaN = inverse ? InvZ[l] : Z[l];

            ModInt[] result = new ModInt[len];
            ModInt zetaNi = 1;
            for (int i = 0; i < len; i++)
            {
                result[i] = hatF0[i % (len / 2)] + zetaNi * hatF1[i % (len / 2)];
                zetaNi *= zetaN;
            }

            return result;
        }

        /// <summary>
        /// a,bからc[k]=Σ(a[i]*b[k-i])を求める
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static double[] Convolution(double[] a, double[] b)
        {
            int n = 1;
            while (n < (a.Length + b.Length))
            {
                n *= 2;
            }

            var compA = new Complex[n];
            for (int i = 0; i < a.Length; i++)
            {
                compA[i] = new Complex(a[i], 0);
            }

            var compB = new Complex[n];
            for (int i = 0; i < b.Length; i++)
            {
                compB[i] = new Complex(b[i], 0);
            }

            Complex[] hatG = Transform(compA);
            Complex[] hatH = Transform(compB);
            Complex[] hatF = new Complex[n];
            for (int i = 0; i < n; i++)
            {
                hatF[i] = hatG[i] * hatH[i];
            }

            Complex[] nF = Transform(hatF, true);

            double[] f = new double[n];
            for (int i = 0; i < n; i++)
            {
                f[i] = nF[i].Real / n;
            }

            return f;
        }

        public static Complex[] DiscreteFourierTransform(Complex[] a, bool inverse = false)
        {
            int n = 1;
            while (n < a.Length)
            {
                n *= 2;
            }

            Complex[] aa = new Complex[n];
            for (int i = 0; i < a.Length; i++)
            {
                aa[i] = a[i];
            }

            return Transform(aa, inverse);
        }

        // f(x) = Σa_i*x^i の離散フーリエ変換
        // deg(f)は2羃
        private static Complex[] Transform(Complex[] a, bool inverse = false)
        {
            int n = a.Length;
            if (n == 1)
            {
                return a;
            }

            Complex[] a0 = new Complex[n / 2];
            Complex[] a1 = new Complex[n / 2];
            for (int i = 0; i < n / 2; i++)
            {
                a0[i] = a[2 * i];
                a1[i] = a[2 * i + 1];
            }

            Complex[] hatF0 = Transform(a0, inverse);
            Complex[] hatF1 = Transform(a1, inverse);

            // ζ_n
            Complex zetaN = Zeta(inverse ? -n : n);

            var result = new Complex[n];

            // ζ_n^i
            Complex zetaNi = 1;
            for (int i = 0; i < n; i++)
            {
                result[i] = hatF0[i % (n / 2)] + zetaNi * hatF1[i % (n / 2)];
                zetaNi *= zetaN;
            }

            return result;
        }

        private static Complex Zeta(int n)
        {
            double rad = 2 * Math.PI / n;
            double re = Math.Cos(rad);
            double im = Math.Sin(rad);
            return new Complex(re, im);
        }

        public struct ModInt
        {
            private const long Mod1 = (1L << 27) * 15 + 1;
            private const long Mod2 = (1L << 26) * 27 + 1;
            public long Num1 { get; private set; }
            public long Num2 { get; private set; }

            public long Num
            {
                get
                {
                    long pq;
                    return EMath.ChaineseRemainderTheorem(Num1, Mod1, Num2, Mod2, out pq);
                }
            }

            public ModInt(long n)
            {
                Num1 = n % Mod1;
                Num2 = n % Mod2;
            }

            public ModInt(long n, long m)
            {
                Num1 = n % Mod1;
                Num2 = m % Mod2;
            }

            public static implicit operator ModInt(long n)
            {
                return new ModInt(n);
            }

            public static ModInt operator *(ModInt a, ModInt b)
            {
                return new ModInt(a.Num1 * b.Num1, a.Num2 * b.Num2);
            }

            public static ModInt operator +(ModInt a, ModInt b)
            {
                return new ModInt(a.Num1 + b.Num1, a.Num2 + b.Num2);
            }

            public static ModInt Pow(ModInt a, long b)
            {
                ModInt result = 1;
                while (b > 0)
                {
                    if (b % 2 == 1)
                    {
                        result *= a;
                    }

                    a *= a;
                    b /= 2;
                }

                return result;
            }

            public static ModInt Inverse(int n)
            {
                long t1 = n;
                long num1 = 1;
                long b1 = Mod1 - 2;
                while (b1 > 0)
                {
                    if (b1 % 2 == 1)
                    {
                        num1 *= t1;
                        num1 %= Mod1;
                    }

                    t1 *= t1;
                    t1 %= Mod1;
                    b1 /= 2;
                }

                long t2 = n;
                long num2 = 1;
                long b2 = Mod2 - 2;
                while (b2 > 0)
                {
                    if (b2 % 2 == 1)
                    {
                        num2 *= t2;
                        num2 %= Mod2;
                    }

                    t2 *= t2;
                    t2 %= Mod2;
                    b2 /= 2;
                }

                return new ModInt(num1, num2);
            }
        }
    }
}

namespace CompLib.Mathematics
{
    public static partial class EMath
    {
        private static long Mod(long a, long m)
        {
            return (a % m + m) % m;
        }

        /// <summary>
        /// n%p=a, n%q=b, n%lcm(p*q)を求める ただしa=b (mod gcd(p,q))
        /// </summary>
        /// <param name="a"></param>
        /// <param name="p"></param>
        /// <param name="b"></param>
        /// <param name="q"></param>
        /// <returns></returns>
        public static long ChaineseRemainderTheorem(long a, long p, long b, long q, out long pq)
        {
            long c, d;
            long e = EMath.ExtGCD(p, q, out c, out d);
            pq = p / e * q;
            if (a % e != b % e)
            {
                return -1;
            }

            // pc + qd = e 

            // n = a + p(b-a)c/e

            // p(b-a)c/e (mod lcm(pq))

            long tmp = (b - a) / e * c % (q / e);
            return (a + Mod(p * tmp, pq)) % pq;
        }
    }
}

namespace CompLib.Mathematics
{
    public partial class EMath
    {
        /// <summary>
        /// ap+bq=gcd(a,b)を求め,gcd(a,b)を返す
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <param name="p"></param>
        /// <param name="q"></param>
        /// <returns></returns>
        public static long ExtGCD(long a, long b, out long p, out long q)
        {
            if (b == 0)
            {
                p = 1;
                q = 0;
                return a;
            }

            long d = ExtGCD(b, a % b, out q, out p);
            q -= a / b * p;
            return d;
        }
    }
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 72304