#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  long ans = 0, temp = 0;
  cin >> N >> M;
  int A[N];
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  for (int k = 1; k <= N; k++) {
    for (int s = 1; s <= N - k + 1; s++) {
      temp = 0;
      for (int u = k; u <= k + s - 1; u++) {
        temp = temp + A[u];
      }
      if (temp % M == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
