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