#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-5;
const double PI = acos(-1.0);
int n, m;
long long a[100002];
long long sum[100002];
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = (0); i < (n); ++i) cin >> a[i];
  sum[0] = a[0];
  for (int i = (1); i < (n); ++i) sum[i] = sum[i - 1] + a[i];
  long long ans = 0;
  int N = 320;
  for (int i = 0; i < N; i++) {
    int st = i * N;
    if (st >= n) break;
    int end = (i + 1) * N;
    if (end > n) end = n;
    long long x = sum[st] - a[st];
    for (int j = st; j < end; j++) {
      for (int k = j; k < end; k++) {
        if ((sum[k] - sum[j] + a[j] + x) % m == 0) ans++;
      }
    }
  }
  cout << (ans) << endl;
  ;
}
