#include <bits/stdc++.h>
using namespace std;
using lint = long long;
struct Fast {
  Fast() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} fast;
const long long INF = INT_MAX;
const lint LINF = LLONG_MAX;
const long long MOD = 1e9 + 7;
const double EPS = 1e-9;
inline long long in() {
  long long x;
  cin >> x;
  return x;
}
inline lint IN() {
  lint x;
  cin >> x;
  return x;
}
inline void co(long long a[], long long n) {
  for (long long i = 0; i < n; ++i) cout << a[i] << " ";
  cout << "\n";
}
signed main() {
  long long n = in();
  long long m = in();
  long long a[n];
  for (long long i = 0; i < n; ++i) a[i] = in();
  long long b = 0;
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    for (long long j = i; j < n; ++j) {
      for (long long k = i; k < j + 1; ++k) {
        if (a[k] % m == 0 and a[k] >= m) {
          a[k] = a[k] % m;
        }
        b += a[k];
      }
      if (b % m == 0) {
        ++ans;
      }
      b = 0;
    }
  }
  cout << ans << "\n";
  return 0;
}
