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