#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m;
  long long ans = 0;
  cin >> n >> m;
  int a[n];
  long long b[n];
  long long ct2 = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      b[i] += a[j];
      if (b[i] % m == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
