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