#include <bits/stdc++.h>
using namespace std;
int A;
long long F(int v[], int l, int r, int n, int s[], int s_len) {
  if (r - l < n) return 0;
  if (n == 0) {
    int sum = 0;
    for (int i = 0; i < s_len; ++i) {
      sum += s[i];
    }
    if (sum == s_len * A)
      return 1;
    else
      return 0;
  }
  long long res = 0;
  for (int i = l; i < r; ++i) {
    s[s_len] = v[i];
    res += F(v, i + 1, r, n - 1, s, s_len + 1);
  }
  return res;
}
int main() {
  int n;
  int v[55];
  cin >> n >> A;
  for (int i = 0; i < n; ++i) cin >> v[i];
  int s[55];
  int s_len = 0;
  long long res = 0;
  for (int i = 1; i <= n; ++i) {
    res += F(v, 0, n, i, s, s_len);
  }
  cout << res << endl;
  return 0;
}
