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