#include <bits/stdc++.h>
using namespace std;
const int MAX = 100000;
long long int xmfl[MAX];
int d[MAX];
int N, M;
int cnt;
long long segment(int n, int _start_, int _end_) {
  if (_start_ == _end_)
    return xmfl[n] = d[_start_];
  else
    return xmfl[n] = segment(2 * n + 1, _start_, (_start_ + _end_) / 2) +
                     segment(2 * n + 2, (_start_ + _end_) / 2 + 1, _end_);
}
long long fi(int n, int gl, int gr, int _start_, int _end_) {
  if (gl > _end_ || gr < _start_) return 0;
  if (_start_ >= gl && gr >= _end_)
    return xmfl[n];
  else
    return fi(2 * n + 1, gl, gr, _start_, (_start_ + _end_) / 2) +
           fi(2 * n + 2, gl, gr, (_start_ + _end_) / 2 + 1, _end_);
}
int main() {
  scanf("%d %d", &N, &M);
  for (int i = 0; i < N; i++) scanf("%d", &d[i]);
  segment(0, 0, N - 1);
  for (int i = 0; i < N; i++)
    for (int j = i; j < N; j++) {
      if (fi(0, i, j, 0, N - 1) % M == 0) cnt++;
    }
  printf("%d", cnt);
}
