#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int l, r;
  long long int N, M, a;
  long long int ans = 0;
  long long int sum = 0;
  long long int A[100050];
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> a;
    if (i == 0)
      A[i] = a;
    else
      A[i] = A[i - 1] + a;
    if (A[i] % M == 0) ans++;
    if (a % M == 0 && i != 0) ans++;
  }
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 2; j < N; j++) {
      if ((A[j] - A[i]) % M == 0) ans++;
    }
  }
  std::cout << ans << std::endl;
}
