#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  int elm[N];
  for (int i = 0; i < N; ++i) {
    cin >> elm[i];
  }
  long long count = 0;
  int value = 0;
  for (int i = 0; i < N; ++i) {
    value = 0;
    for (int j = i; j < N; ++j) {
      value += elm[j];
      if (value % M == 0) count++;
    }
  }
  cout << count << endl;
}
