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