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