#include <bits/stdc++.h>
using namespace std;
const long long maxx = 1e5 + 50;
long long a[maxx];
int main() {
  long long n, k;
  long long ans = 0;
  cin >> n >> k;
  long long temp;
  for (int i = 1; i <= n; i++) {
    cin >> temp;
    a[i] = a[i - 1] + temp;
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j <= n; j++) {
      temp = a[j] - a[i];
      if (temp % k == 0) ans++;
    }
  cout << ans << endl;
}
