#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, tmp, sum = 0;
  long long count = 0;
  cin >> N >> M;
  int A[N];
  cin >> A[0];
  A[0] = A[0] % M;
  for (int i = 1; i < N; i++) {
    cin >> tmp;
    A[i] = (A[i - 1] + tmp) % M;
  }
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) count++;
    for (int j = 0; j < i; j++) {
      if (A[i] == A[j]) count++;
    }
  }
  cout << count << "\n";
  return 0;
}
