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