#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  int A[N];
  int ret = 0;
  int sum;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    A[i] = A[i] % M;
  }
  for (int l = 0; l < N; l++) {
    for (int r = l; r < N; r++) {
      sum = 0;
      for (int i = l; i <= r; i++) {
        sum += A[i];
        sum = sum % M;
      }
      if (sum == 0) {
        ret++;
      }
    }
  }
  cout << ret << endl;
  return 0;
}
