#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  long n, m, i;
  vector<long> v;
  cin >> n >> m;
  while (cin >> i) {
    v.push_back(i);
  }
  int count = 0;
  for (int i = 0; i < v.size(); i++) {
    for (int j = i; j < v.size(); j++) {
      long c = 0;
      for (int k = i; k <= j; k++) {
        c += v[k];
      }
      if ((c % m) == 0) {
        count++;
      }
    }
  }
  cout << count;
}
