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