#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m;
  int *x, take = 0, ans;
  cin >> n >> m;
  x = new int[n];
  for (int i = 1; i <= n; i++) cin >> x[i];
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      ans = 0;
      for (int k = i; k <= j; k++) ans += x[k];
      if (ans % m == 0) take++;
    }
  }
  delete[] x;
  cout << take << endl;
  return 0;
}
