#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    a[i] = a[i] % m;
  }
  long int ans = 0;
  for (int i = 0; i < n; i++) {
    int amari = 0;
    for (int j = i; j < n; j++) {
      amari += a[j];
      if (amari % m == 0) {
        ans++;
      }
    }
  }
  printf("%ld\n", ans);
  return 0;
}
