using System;
using System.Linq;

namespace takmicenje
{
    class Program
    {
        static int n;
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] d = new string[2];
            d = input.Split(' ');

            n = int.Parse(d[0]);
            int k = int.Parse(d[1]);

            string[] f = new string[n];
            input = Console.ReadLine();
            f = input.Split(' ');

            int[] nums = Array.ConvertAll(f, s => int.Parse(s));

            Console.WriteLine(func(nums, k));

            Console.ReadLine();
            

        }

        static double func(int[] brojevi, int k)
        {
            if(k == 0)
            {
                return brojevi.Sum();
            }
            else
            {
                double justToSumUp = 0;
                for (int i = 0; i < brojevi.Length; i++)
                {
                    for (int j = i; j < brojevi.Length; j++)
                    {
                        int[] podskup = new int[j - i + 1];
                        justToSumUp += func(brojevi[i..j], k - 1);
                    }
                }

                return justToSumUp;
            }
           
        }
    }
}