#include <bits/stdc++.h>
using namespace ::std;
long long N, M, ans, A[100000], AA[100000];
string S, s;
bool h, k[101];
int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (i == 0)
      AA[i] = A[i];
    else {
      AA[i] = A[i] + AA[i - 1];
      AA[i] = AA[i] % M;
    }
  }
  for (int l = 0; l < N; l++) {
    for (int r = l; r < N; r++) {
      if (r != l) {
        if ((AA[r] - AA[l]) % M == 0) ans++;
      } else {
        if (AA[r] % M == 0) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
