#include <bits/stdc++.h>
using namespace std;
int main() {
  long long unsigned n, m;
  cin >> n >> m;
  vector<long long unsigned> arr(n + 1);
  for (long long unsigned i = 0; i < n; i++) {
    scanf("%ld ", &arr[i + 1]);
    arr[i + 1] += arr[i];
  }
  long long unsigned ret = 0;
  for (long long unsigned i = 1; i <= n; i++) {
    for (long long unsigned j = i; j <= n; j++) {
      if ((arr[j] - arr[i - 1]) % m == 0) ret++;
    }
  }
  cout << ret << endl;
  return 0;
}
