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