#include <bits/stdc++.h>
using namespace std;
const int N = 51;
int main() {
  int n;
  int a;
  while (cin >> n >> a && n) {
    int b[N][N * N] = {0};
    int p;
    long long cnt = 0;
    b[0][0] = 1;
    for (int i = 1; i <= n; i++) {
      cin >> p;
      for (int j = i - 1; j >= 0; j--) {
        for (int k = 0; k <= N * j; k++) {
          b[j - 1][p + k] += b[j][k];
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      cnt += b[i][i * a];
    }
    cout << cnt << endl;
  }
  return 0;
}
