#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  vector<int> A;
  double cnt = 0;
  scanf("%d%d", &N, &M);
  for (int i = 0; i < N; i++) {
    int temp;
    scanf("%d", &temp);
    A.push_back(temp);
  }
  for (int x = 0; x < N; x++) {
    double sum = 0;
    for (int y = x; y < N; y++) {
      sum += A[y];
      if (0 == fmod(sum, M)) {
        cnt++;
      }
    }
  }
  printf("%.0lf", cnt);
  return 0;
}
