#include <bits/stdc++.h>
using namespace std;
int n;
long m, a, c[100010], s;
int main() {
  cin >> n >> m;
  c[0] = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    c[i + 1] = c[i] + a;
  }
  s = 0;
  for (int l = 0; l < n; ++l) {
    for (int r = l + 1; r <= n; ++r) {
      if ((c[r] - c[l]) % m == 0) s++;
    }
  }
  cout << s;
}
