#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  int A[N];
  int i, j;
  for (i = 0; i < N; i++) {
    cin >> A[i];
  }
  unsigned long long sumcase = 0;
  unsigned long long psum[N][N];
  for (i = 0; i < N; i++) {
    psum[i][i] = A[i];
    if (psum[i][i] % M == 0) {
      sumcase++;
    }
  }
  for (i = 0; i < N; i++) {
    for (j = i + 1; j < N; j++) {
      psum[i][j] = psum[i][j - 1] + A[j];
      if (psum[i][j] % M == 0) {
        sumcase++;
      }
    }
  }
  cout << sumcase << endl;
  return 0;
}
