#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  long long M;
  cin >> N >> M;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<long long> B(N + 1, 0);
  for (int i = 0; i < N; i++) B[i + 1] = B[i] + A[i];
  long long ans = 0LL;
  vector<vector<long long> > memo(N, vector<long long>(0));
  for (int i = 0; i < N; i++) {
    long long tmp = A[i];
    if (i != 0) {
      for (int j = 0; j < memo[i - 1].size(); j++) {
        if (memo[i - 1][j] % M == 0) ans++;
        memo[i].push_back((memo[i - 1][j] + tmp) % M);
      }
    }
    memo[i].push_back(tmp % M);
  }
  for (int j = 0; j < memo[N - 1].size(); j++)
    if ((memo[N - 1][j]) % M == 0) ans++;
  cout << ans << endl;
  return 0;
}
