#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, M;
  cin >> N >> M;
  int A[N];
  int i, j;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int count = 0;
  int l, r;
  long long sum = 0;
  for (int l = 0; l < N; l++) {
    for (r = l; r < N; r++) {
      sum += A[r];
      if (sum % M == 0) {
        count++;
      }
    }
    sum = 0;
  }
  cout << count << endl;
  return 0;
}
