#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int N;
  long long M;
  cin >> N >> M;
  vector<long long> a(N);
  for (int i = 0; i < (N); i++) cin >> a[i];
  vector<long long> s(N + 1);
  for (int i = 0; i < (N); i++) s[i + 1] = s[i] + a[i];
  long long ans = 0;
  for (int l = 0; l < N + 1; l++) {
    for (int r = l + 1; r < N + 1; r++) {
      if ((s[r] - s[l]) % M == 0) ans++;
    }
  }
  cout << ans << endl;
}
