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