#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 + 1];
  long long ct2 = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i + 1] = 0;
    if (a[i] % m == 0) ans++;
  }
  b[1] = a[0];
  for (int i = 2; i < n + 1; i++) {
    b[i] = b[i - 1] + a[i - 1];
    ct2 = b[i];
    if (ct2 % m == 0) ans++;
    for (int j = 0; j < n - i; j++) {
      ct2 += a[j + i] - a[j];
      if (ct2 % m == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
