#include <bits/stdc++.h>
using namespace ::std;
int main() {
  long long int N;
  long long int M;
  cin >> N;
  cin >> M;
  long long int* num = new long long int[N];
  for (int i = 0; i < N; i++) {
    cin >> num[i];
  }
  long long int sum = 0;
  long long int count = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      for (int k = i; k < j + 1; k++) {
        sum = sum + num[k];
      }
      if (sum % M == 0) {
        count++;
      }
      sum = 0;
    }
  }
  cout << count;
  delete[] num;
}
