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