#include <bits/stdc++.h>
int N;
long long M, cnt = 0;
const int maxn = 1e6 + 5;
long long a[maxn], pre[maxn] = {0};
int main() {
  scanf("%d%lld", &N, &M);
  for (int i = 1; i <= N; i++) {
    scanf("%lld", &a[i]);
    pre[i] = pre[i - 1] + a[i];
  }
  for (int i = 0; i < N; i++)
    for (int j = i + 1; j <= N; j++) {
      if ((pre[j] - pre[i]) % M == 0) cnt++;
    }
  printf("%lld\n", cnt);
  return 0;
}
