#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int arr[105000], ans;
long long tree[105000];
long long n, m;
long long lowbit(long long t) { return t & (-t); }
void add(long long index, long long val) {
  for (long long i = index; i <= n; i += lowbit(i)) tree[i] += val;
}
long long get_sum(long long index) {
  long long ans = 0;
  for (long long i = index; i > 0; i -= lowbit(i)) ans += tree[i];
  return ans;
}
long long get_ans(long long l, long long r) {
  return get_sum(r) - get_sum(l - 1);
}
void init() {
  memset(tree, 0, sizeof(tree));
  ans = 0;
}
int main() {
  while (~scanf("%lld %lld", &n, &m)) {
    init();
    long long x;
    for (long long i = 1; i <= n; i++) {
      scanf("%d", &x);
      add(i, x);
    }
    for (long long i = 1; i <= n; i++) {
      for (long long j = i; j <= n; j++) {
        if (get_ans(i, j) % m == 0) ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
