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