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