#include <bits/stdc++.h>
int dp[100001];
long res;
int N, M;
int A[100001];
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
void solve() {
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < i; j++) {
      if ((dp[i] - dp[j]) % M == 0) res++;
    }
  }
  cout << res << endl;
}
int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (i > 0) dp[i] = (dp[i - 1] + A[i]) % M;
    if (dp[i] == 0) res++;
  }
  solve();
  return 0;
}
