#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, k[100005], count = 0;
  cin >> a >> b;
  for (int i = 0; i < a; ++i) {
    cin >> k[i];
  }
  long long int sum;
  for (int i = 0; i < a; ++i) {
    sum = k[i];
    for (int j = i; j < a; ++j) {
      if (i != j) sum += k[j];
      if (sum % b == 0) count++;
    }
  }
  cout << count << endl;
}
