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