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