#include <bits/stdc++.h>
using namespace std;
long long dp[60][60];
int main() {
  int n, A, a[100];
  while (~scanf("%d%d", &n, &A)) {
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
      for (int k = 0; k <= A; k++) {
        if (dp[i][k] == 0) continue;
        int kk = (k + a[i + 1]) % A;
        dp[i + 1][kk] += dp[i][k];
        dp[i + 1][k] += dp[i][k];
      }
    }
    cout << dp[n][0] - 1 << endl;
  }
  return 0;
}
