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