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