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