#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];
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    A[i] = tmp % M;
  }
  for (int i = 0; i < N; i++) {
    sum = (sum + A[i]) % M;
    tmp = sum;
    if (sum == 0) count++;
    for (int j = 0; j < i; j++) {
      tmp = (tmp - A[j]) % M;
      if (tmp == 0) count++;
    }
  }
  cout << count << "\n";
  return 0;
}
