#include <bits/stdc++.h>
int main(void) {
  int n, m;
  int box[100005];
  box[0] = 0;
  scanf("%d%d", &n, &m);
  long long int ans = 0;
  long long int temp;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &box[i]);
  }
  for (int i = 0; i <= n; i++) {
    temp = 0;
    for (int j = i + 1; j <= n; j++) {
      temp += box[j];
      if (temp % m == 0) ans++;
    }
  }
  printf("%lld\n", ans);
}
