#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  int A[100000];
  cin >> N >> M;
  for (int i = 0; i < N; ++i) cin >> A[i];
  long long ans = 0;
  int tmp = 0;
  for (int l = 0; l < N - 1; ++l) {
    tmp = A[l];
    if (tmp % M == 0) ans++;
    for (int r = l + 1; r < N; ++r) {
      tmp += A[r];
      if (tmp % M == 0) ans++;
    }
  }
  cout << ans << endl;
}
