#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long sum[105000], ans, n, m;
void init() {
  memset(sum, 0, sizeof(sum));
  ans = 0;
}
int main() {
  while (~scanf("%lld %lld", &n, &m)) {
    init();
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &sum[i]);
      sum[i] += sum[i - 1];
    }
    for (int len = 1; len <= n; len++) {
      for (int i = 1; i <= n; i++) {
        int j = i + len - 1;
        if (j > n) break;
        if ((sum[j] - sum[i - 1]) % m == 0) {
          ans++;
        }
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
