#include <bits/stdc++.h>
int main() {
  size_t n;
  uint_fast32_t m;
  scanf("%zu %" SCNuFAST32, &n, &m);
  uint_fast32_t a[100000];
  for (size_t i = 0; i < n; ++i) {
    scanf("%" SCNuFAST32, &a[i]);
    a[i] %= m;
  }
  uint_fast64_t ans = 0;
  for (size_t i = 0; i < n; ++i) {
    uint_fast32_t sum = 0;
    for (size_t j = i; j < n; ++j) {
      sum += a[j];
      if (sum >= m) {
        sum -= m;
      }
      if (sum == 0) {
        ++ans;
      }
    }
  }
  printf("%" PRIuFAST64 "\n", ans);
  return 0;
}
