#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, count;
  cin >> N >> M;
  vector<int> box(N);
  for (int i = 0; i < N; i++) {
    cin >> box.at(i);
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= i; j++) {
      int S = 0;
      for (int k = j; k <= i; k++) {
        S += box.at(k);
        S = S % M;
      }
      if (S == 0) count++;
    }
  }
  cout << count << endl;
}
