#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int n, m;
  int *boxes, *dp;
  scanf("%d %d", &n, &m);
  boxes = new int[n];
  dp = new int[n];
  long res = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", boxes + i);
    if (boxes[i] % m == 0) {
      dp[i] = 1;
    } else {
      dp[i] = 0;
    }
    long s = boxes[i];
    for (int j = i - 1; j >= 0; j--) {
      if (s % m == 0 && dp[j] != 0) {
        dp[i] += dp[j];
        break;
      }
      s += boxes[j];
      if (s % m == 0) dp[i]++;
    }
  }
  for (int i = 0; i < n; i++) {
    res += dp[i];
  }
  printf("%ld", res);
  return 0;
}
