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