#include <bits/stdc++.h>
const int maxn = 0x3f3f3f3f;
const int mass = 1e5 + 5;
using namespace std;
long long int a[mass];
int main() {
  int n, m;
  long long int cnt = 0;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (a[i] % m == 0) cnt++;
  }
  long long int sum = 0;
  for (int i = 1; i < n; i++) {
    sum = a[i];
    for (int j = i + 1; j <= n; j++) {
      sum += a[j];
      if (sum % m == 0) cnt++;
    }
    sum = 0;
  }
  printf("%lld\n", cnt);
  return 0;
}
