#include <bits/stdc++.h>
using namespace std;
long N, M;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> M;
  unsigned long A[N];
  unsigned long B[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    B[i] = A[i] % M;
  }
  unsigned long ans = 0;
  for (int i = 0; i < N; i++) {
    for (unsigned long j = i; j < N; ++j) {
      unsigned long sum = 0;
      for (unsigned long k = i; k <= j; ++k) {
        sum += B[k];
      }
      if (sum % M == 0) {
        ans += 1;
      }
    }
  }
  cout << ans << endl;
}
