#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int LINF = 0x3f3f3f3f3f3f3f3f;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
template <typename T>
inline void out(T x) {
  cout << x;
}
const int N = 1e5 + 7;
long long a[N];
long long ans;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] %= m;
    a[i] += a[i - 1];
    a[i] %= m;
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      if ((a[j] - a[i - 1] + m) % m == 0) ans++;
  cout << ans;
}
