#include <bits/stdc++.h>
using namespace std;
long gcd(long a, long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long x(long *v, int n) {
  long result = v[0];
  for (int i = 0; i < n; i++) result = gcd(result, v[i]);
  return result;
}
int main() {
  int n;
  cin >> n;
  int m;
  cin >> m;
  int ans = 0;
  long *v = new long[n];
  for (int i = 0; i < n; i++) {
    long p;
    cin >> p;
    v[i] = p;
  }
  long gc = x(v, n);
  for (int i = 0; i < n; i++) v[i] /= gc;
  m /= gc;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      long long c = accumulate(v + i, v + j + 1, 0);
      if (c % m == 0) ans++;
    }
  }
  cout << ans;
  return 0;
}
