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