#include <bits/stdc++.h>
using namespace std;
int a[100005];
long long s[100005];
int main() {
  int i, j, k = 0, n, m;
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    s[i] = s[i - 1] + a[i];
  }
  for (i = 1; i <= n; i++)
    for (j = i; j <= n; j++) {
      if ((s[j] - s[i - 1]) % m == 0) k++;
    }
  printf("%d", k);
  return 0;
}
