#include <bits/stdc++.h>
using namespace std;
void solver(int *nums, int numsSize, int m) {
  int i, j;
  long long int sum = 0;
  long long int ret = 0;
  long long int dp[100001] = {0};
  if (nums[0] % m == 0) {
    ret = 1;
    dp[1] = 1;
  }
  for (i = 2; i < numsSize + 1; ++i) {
    sum = nums[i - 1];
    for (j = i - 1; j > 0; --j) {
      if (sum % m == 0) {
        dp[i] = dp[j] + 1;
        break;
      }
      sum += nums[j - 1];
    }
    if (sum % m == 0 && j == 0) dp[i]++;
    ret += dp[i];
  }
  printf("%lld\n", ret);
}
int main() {
  int i, n, m;
  int a[100001] = {0};
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  solver(a, n, m);
  return 0;
}
