#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const int mx = 100010;
const long long mod = 1e9 + 7;
vector<long long> dp(mx, -1);
long long n, m;
vector<long long> a(mx);
long long rec(int c) {
  if (n <= c) {
    return 0;
  }
  int k = c;
  if (dp[c] != -1) {
    return dp[c];
  }
  long long tmp = a[k];
  k++;
  while (tmp % m != 0 && k < n) {
    tmp += a[k];
    k++;
  }
  if (k == n && tmp % m != 0) {
    return dp[c] = 0;
  }
  return dp[c] = 1 + rec(k);
}
int main() {
  cin >> n >> m;
  for (int i = (int)(0); i < (int)(n); ++i) {
    cin >> a[i];
    a[i] %= m;
  }
  long long ans = 0;
  for (int i = (int)(0); i < (int)(n); ++i) {
    ans += rec(i);
  }
  cout << ans << endl;
  return 0;
}
