#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long N, M;
  unsigned long long res = 0;
  cin >> N >> M;
  long A[N];
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < N; ++i) {
    long sum = 0;
    for (int j = i; j < N; ++j) {
      sum += A[j];
      sum = sum % M;
      if (sum == 0) res++;
    }
  }
  (cout << res << endl);
  return 0;
}
