#include <bits/stdc++.h>
using namespace std;
map<int, int> mpa, mpb;
priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
               greater<pair<long long, long long>>>
    pque;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long N, M;
  cin >> N >> M;
  long long N_MAX = 100100;
  long long a[100100];
  long long A;
  a[0] = 0;
  for (int i = 1; i <= N; i++) {
    cin >> A;
    A %= M;
    a[i] = A;
  }
  for (int i = 1; i <= N; i++) {
    a[i] = a[i - 1] + a[i];
    a[i] %= M;
  }
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j <= N; j++) {
      if ((a[j] - a[i]) % M == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
