#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  vector<long long int> v;
  long long int num;
  for (int i = 0; i < n; i++) {
    cin >> num;
    v.push_back(num);
  }
  long long int cnt = 0, sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      sum += v[j];
      if (sum % m == 0) {
        cnt++;
      }
    }
    sum = 0;
  }
  cout << cnt << endl;
}
