#include <bits/stdc++.h>
using namespace std;
vector<long long> a, s;
int main() {
  int m, n, i, j;
  int ans = 0;
  scanf("%d%d", &n, &m);
  a.resize(n + 1);
  s.resize(n + 1);
  s[0] = 0;
  for (i = 1; i <= n; i++) {
    scanf("%lld", &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) ans++;
    }
  }
  printf("%d", ans);
  return 0;
}
