#include <bits/stdc++.h>
using namespace std;
template <class T, class S>
T atbit(T n, S i) {
  return (n >> i) % i;
}
template <class T>
T getbit(T i) {
  return 1LL << i;
}
using namespace std;
long long A[100100] = {0LL};
long long sum[100100] = {0LL};
int main() {
  long long N, M;
  cin >> N >> M;
  for (long long i = 0; i < N; ++i) {
    scanf("%d", &A[i]);
    sum[i + 1] += (i > 0 ? sum[i] : 0) + A[i];
  }
  long long cnt = 0LL;
  for (long long l = 0; l < N; ++l) {
    for (long long r = l; r < N; ++r) {
      if ((sum[r + 1] - sum[l]) % M == 0) {
        ++cnt;
      }
    }
  }
  cout << cnt;
}
