#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
long long n, m, a[maxn], b[maxn], ans = 0;
;
int main() {
  b[0] = 0;
  scanf("%lld%lld", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    b[i] = b[i - 1] + a[i];
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      if ((b[j] - b[i - 1]) % m == 0 && b[j] != b[i - 1]) ans++;
  printf("%lld", ans);
}
