#include <bits/stdc++.h>
using namespace std;
const int MAX = 100000;
int n, m;
int d[MAX];
int cnt;
long long xmfl[MAX];
long long segment(int X, int L, int R) {
  int m = (L + R) / 2;
  if (L == R)
    return xmfl[X] = d[L];
  else
    xmfl[X] = segment(2 * X + 1, L, m) + segment(2 * X + 2, m + 1, R);
}
long long fi(int X, int gL, int gR, int L, int R) {
  int m = (L + R) / 2;
  if (R < gL || gR < L) return 0;
  if (gL <= L && R <= gR) return xmfl[X];
  return fi(2 * X + 1, gL, gR, L, m) + fi(2 * X + 2, gL, gR, m + 1, R);
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &d[i]);
  segment(0, 0, n - 1);
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++) {
      if (fi(0, i, j, 0, n - 1) % m == 0) cnt++;
    }
  printf("%d", cnt);
}
