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