#include <bits/stdc++.h>

#define ll long long
#define ar array

#define ff first 
#define ss second 
#define mp make_pair

#define pb push_back

#define rep(i,n) for(auto i=0; i<(n); i++) 

#define all(x) (x).begin(), (x).end() 

using namespace std;

typedef  map<string,int>         msi; 
typedef  map<int,int>	         mii; 
typedef  map<ll, ll>             mll; 
typedef  map<char,int>           mci; 
typedef  map<int,string>	     mis; 
typedef  pair<int,int> 	         pii;
typedef  pair<ll, ll> 	         pll;  
typedef  pair<string, int>       psi; 
typedef  pair<string, string>    pss; 
typedef  vector<int> 	         vi;  
typedef  vector<string> 	     vs; 
typedef  vector<char>	         vc; 
typedef  vector<bool>            vb; 
typedef  vector< pii >           vii;
typedef  vector< ll >            vll;
typedef  vector<pii>             vpii;
typedef  vector<pll>             vpll;
typedef  vector<vi>              vvi;
typedef  vector<vll>             vvll;

const int mxN=200010;

vll v(mxN);
int n;

int f(int a,int b, int k){
    ll s=0;
    if(k == 0){
        for(int i = a; i<= b; i++){
            s+= v[i];
        }
        return s;
    }
    for(int i = a; i <= b; i++){
        for(int j = a; j <= b; j++){
            s+=f(i,j,k-1);
        }
    }
    return s;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,k;
    cin >> n >> k;
    rep(i,n){
        cin >> v[i];
    }
    cout << f(0,n-1,k);
    return 0;
}