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