#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main() {
  int n, m, i, j, cnt;
  long long sum;
  while (scanf("%d %d", &n, &m) != EOF) {
    for (i = 1; i <= n; i++) scanf("%d", &a[i]);
    cnt = 0;
    for (i = 1; i <= n; i++) {
      sum = 0;
      for (j = i; j <= n; j++) {
        sum += a[j];
        if (sum % m == 0) cnt++;
      }
    }
    printf("%d\n", cnt);
  }
  return 0;
}
