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