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