#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
int a[60];
void dfs(int dep, int x, int sum) {
  if (dep > n) {
    if (x != 0 && sum % x == 0 && sum / x == m) ans++;
    return;
  }
  dfs(dep + 1, x, sum);
  dfs(dep + 1, x + 1, sum + a[dep]);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dfs(1, 0, 0);
  cout << ans << endl;
  return 0;
}
