#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
long long n,m;
long long N;
long long jyx[300],a[30000],yx[200],maxx=-1;
int print()
{
memset(a,0,sizeof(a));
long long s=0,ans=0;
for(int i=1;i<=N;++i)
{
s=0;
for(int j=0;j<=n-m-1;++j)
if(i&(1<<j))s+=yx[j+1];
if(s!=0)a[s]++;
if(a[s]==1)ans++;
}
maxx=max(maxx,ans);
}
int locin(int k,int b)
{
for(int i=b;i<=m+k;++i)
{
yx[k]=jyx[i];
if(k==n-m)print();
else locin(k+1,i+1);
}
}
int main()
{
cin>>n>>m;
N=1<<(n-m);
for(int i=1;i<=n;++i)cin>>jyx[i];
locin(1,1);
cout<<maxx;
return 0;
}