#include <bits/stdc++.h>
using namespace std;
long long combination(long long n, long long r);
int main() {
  long long N, M, num;
  cin >> N >> M;
  long long longCount = 0;
  vector<long long> longlist2(N + 1, 0);
  for (long long i = 1; i < N + 1; i++) {
    cin >> num;
    longlist2[i] = longlist2[i - 1] + num;
    if (longlist2[i] % M == 0) {
      longCount++;
    }
  }
  cout << combination(longCount + 1, M) << endl;
  return 0;
}
long long combination(long long n, long long r) {
  if (r == 0 || r == n)
    return (1);
  else if (r == 1)
    return (n);
  return (combination(n - 1, r - 1) + combination(n - 1, r));
}
