#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  long long A[10100];
  cin >> N >> M;
  int count = 0;
  for (int i = 0; i < N; ++i) cin >> A[i];
  for (int p = 0; p < N; ++p) {
    long long sum = A[p];
    for (int q = p; q < N; ++q) {
      if (p != q) sum += A[q];
      if (sum % M == 0) ++count;
    }
  }
  cout << count << endl;
}
