#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int A[100010];
  int cnt = 0;
  long long int sumnow;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  for (int l = 0; l < n; l++) {
    sumnow = 0;
    for (int r = l; r < n; r++) {
      sumnow += A[r];
      if (sumnow % m == 0) {
        cnt++;
      }
    }
  }
  printf("%d\n", cnt);
  return 0;
}
