#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, i, l, r;
  int *A;
  unsigned long long n = 0;
  unsigned long long sum;
  cin >> N >> M;
  A = new int[N];
  for (i = 0; i < N; i++) cin >> A[i];
  for (l = 0; l < N; l++) {
    sum = 0;
    for (r = l; r < N; r++) {
      sum += A[r];
      if (sum % M == 0) n++;
    }
  }
  cout << n << endl;
  return 0;
}
