#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long a[100005];
long long sum[100005];
int main() {
  cin >> n >> m;
  sum[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  int res = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] % m == 0) res++;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = n; j >= i; j--) {
      if ((sum[j] - sum[j - i]) % m == 0) res++;
    }
  }
  cout << res;
  return 0;
}
