#include <bits/stdc++.h>
using namespace std;
const int MAX = 50050;
int T, N;
int arr[MAX << 4];
int a[MAX];
void pushup(int root) { arr[root] = arr[root << 1] + arr[root << 1 | 1]; }
void build(int left, int right, int root) {
  if (left == right) {
    arr[root] = a[left];
    return;
  }
  int mid = (left + right) >> 1;
  build(left, mid, root << 1);
  build(mid + 1, right, root << 1 | 1);
  pushup(root);
}
void update(int node, int val, int left, int right, int root) {
  if (left == right) {
    arr[root] += val;
    return;
  }
  int mid = (left + right) >> 1;
  if (node <= mid) {
    update(node, val, left, mid, root << 1);
  } else {
    update(node, val, mid + 1, right, root << 1 | 1);
  }
  pushup(root);
}
int query(int ql, int qr, int left, int right, int root) {
  if (ql <= left && qr >= right) {
    return arr[root];
  }
  int mid = (left + right) >> 1;
  int ans = 0;
  if (ql <= mid) {
    ans += query(ql, qr, left, mid, root << 1);
  }
  if (qr > mid) {
    ans += query(ql, qr, mid + 1, right, root << 1 | 1);
  }
  return ans;
}
int main() {
  int m;
  scanf("%d%d", &N, &m);
  for (int i = 1; i <= N; i++) scanf("%d", &a[i]);
  build(1, N, 1);
  int ans = 0;
  for (int i = 1; i < N; i++) {
    for (int j = i; j <= N; j++) {
      int sum = query(i, j, 1, N, 1);
      if (sum % m == 0) ans++;
    }
  }
  printf("%d", ans);
  return 0;
}
