#include <bits/stdc++.h>
using namespace std;
long long q[100001];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  long long sum = 0;
  int d;
  q[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &d);
    sum += d;
    q[i] = sum;
  }
  long long cnt = 0;
  for (int i = 0; i <= n - 1; i++) {
    for (int j = i + 1; j <= n; j++) {
      if ((q[j] - q[i]) % k == 0) {
        cnt++;
      }
    }
  }
  printf("%lld\n", cnt);
}
