#include<bits/stdc++.h>
using namespace std;
vector<long long>v(200000);
#define pb push_back
long long zbir(vector<long long>niz, int elem)
{
  long long s=0;
  for (long long int i=0; i<elem; i++)
  {
    s+=niz[i];
  }
  return s;
}
long long pobednik(vector<long long>niz, int k, int elem)
{
  if (k==0) return zbir(niz, elem);
  double suma=0;
  for (int i=0; i<elem; i++)
  {
    vector<long long>p;
    for (int j=i; j<elem; j++)
    {
      p.pb(niz[j]);
      suma+=pobednik(p, k-1, j-i+1);
    }
  }
  return suma;
}
int main()
{
  int n,k;
  cin >> n >> k;
  for (int i=0; i<n; i++)
  {
    cin >> v[i];
  }
  cout << pobednik(v,k,n);
  return 0;
}