#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long count = 0, tmp;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      if (j == i)
        tmp = a[j];
      else
        tmp += a[j];
      if (tmp % m == 0) count += 1;
    }
  }
  cout << count << endl;
  return 0;
}
