#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  int M;
  cin >> M;
  
  int A[N] = {0};
  
  for (int i = 0; i < N; i++){
    cin >> A[i];
    A[i] = A[i] % M;
  }
  
  int sum = 0;
  int counter = 0;
  
  for (int i = 0; i < N; i++){
    for (int j = i; j < N; j++){
      sum = 0;
      for (int k = i; k < j+1; k++){
        sum += A[k];
        sum = sum % M;
      }
      if (sum % M == 0) counter++;
    }
  }
  cout << counter;
}