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