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