#include <bits/stdc++.h>
using namespace std;
const int N = 2005, INF = 0x3f3f3f3f;
int dp[N], a[N], f[N], cnt, tot, n, m;
void backpack()
{
memset(dp, 0, sizeof(dp));
dp[0] = 1;
cnt = tot = 0;
for(int i = 0; i < n; i++)
{
if (f[i] != 0) continue;
for (int j = tot; j >= 0; j--)
{
if (dp[j] == 1 && dp[j+a[i]] == 0)
{
dp[j+a[i]] = 1;
cnt++;
}
}
tot += a[i];
}
}
void dfs(int step, int last)
{
if (last > m) return;
//cout << step << " " << last << endl;
if (step == n)
{
if (last == m)
{
//cout << last << endl;
backpack();
}
return;
}
dfs(step+1, last);
f[step] = 1;
dfs(step+1, last+1);
f[step] = 0;
}
int main()
{
cin >> n >> m;
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
dfs(1, 0);
cout << cnt << endl;
return 0;
}