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