#include <bits/stdc++.h>
using namespace std;
long long N, M;
long long A[100000];
int main() {
  cin >> N;
  cin >> M;
  for (long long i = 0; i < N; i++) cin >> A[i];
  for (long long i = 1; i < N; i++) A[i] += A[i - 1];
  long long ans = 0;
  for (long long l = 0; l < N; l++) {
    for (long long r = l; r < N; r++) {
      if (l == 0 && A[r] % M == 0)
        ans++;
      else if ((A[r] - A[l - 1]) % M == 0)
        ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
