#include <bits/stdc++.h>
using namespace std;
const double pi = 4 * atan(1.0);
int main() {
  int N, A;
  cin >> N >> A;
  vector<int> arr(N);
  for (auto& val : arr) cin >> val;
  long long ans = 0;
  for (int i = 0; i < N; ++i) {
    queue<array<int, 3>> Q;
    for (int j = 0; j < N - i; ++j) {
      Q.push({0, j, arr[j]});
    }
    while (!Q.empty()) {
      auto now = Q.front();
      Q.pop();
      if (now[0] >= i) {
        if (now[2] == (i + 1) * A) ++ans;
      } else {
        for (int j = now[1] + 1; j < N - (i - now[0] - 1); ++j) {
          Q.push({now[0] + 1, j, now[2] + arr[j]});
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
