#include <bits/stdc++.h>
using namespace std;
int A[100009];
int main() {
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> A[i];
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int total = 0;
    for (int j = i; j < N; j++) {
      total += A[j];
      if (total % M == 0) ans++;
    }
  }
  cout << ans << endl;
}
