#include <bits/stdc++.h>
using namespace std;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
int main(int argc, char const *argv[]) {
  long N, M, buf;
  unsigned long long res = 0;
  cin >> N >> M;
  long A[N], kkn[N], cnt[N];
  for (int i = 0; i < N; ++i) {
    kkn[i] = cnt[N] = -1;
  }
  for (int i = 0; i < N; ++i) {
    cin >> buf;
    A[i] = buf % M;
  }
  int cnts = 0;
  for (int i = 0; i < N; ++i) {
    long sum = 0;
    long prev = i;
    for (int j = i; j < N; ++j) {
      if (kkn[j] == -1) {
        sum += A[j];
        sum = sum % M;
        if (sum == 0) {
          res++;
          kkn[prev] = j;
          prev = j;
        }
      } else {
        j = kkn[j] - 1;
        res++;
      }
    }
  }
  (cout << res << endl);
  return 0;
}
