#include <bits/stdc++.h>
using namespace std;
const int M = 100000 + 5;
int main() {
  long long n, m, sum;
  int a[M], t = 0;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    sum = a[i];
    if (sum % m == 0) t++;
    for (int j = i + 1; j < n; j++) {
      sum += a[j];
      if (sum % m == 0) t++;
    }
  }
  printf("%d\n", t);
}
