#include <bits/stdc++.h>
using namespace std;
long long N, M, A;
vector<long long> cs;
int main() {
  scanf("%lld %lld", &N, &M);
  long long buf = 0;
  cs.push_back(0);
  for (int i = 0; i < N; ++i) {
    scanf("%lld", &A);
    cs.push_back(A + buf);
    buf += A;
  }
  long long cnt = 0;
  for (int i = 1; i <= N; ++i) {
    for (int j = i; j <= N; ++j) {
      long long sum = cs[j] - cs[i - 1];
      if (sum % M == 0) cnt += 1;
    }
  }
  printf("%lld\n", cnt);
  return 0;
}
