#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  int A[N + 5];
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  vector<ll> pa(N);
  pa[0] = 0;
  for (int i = 1; i <= N; i++) {
    pa[i] = pa[i - 1] + A[i];
  }
  int ans = 0;
  for (int i = 0; i <= N; i++) {
    for (int j = i + 1; j <= N; j++) {
      if ((pa[j] - pa[i]) % M == 0) ans++;
    }
  }
  cout << ans << '\n';
  return 0;
}
