#include <bits/stdc++.h>
using namespace std;
int n, m, t;
long long ans, MOD = 1000000007, x[63];
void dfs(int k, bitset<120> f, long long res) {
  if (!k)
    (ans += res) %= MOD;
  else {
    dfs(k - 1, f, res);
    if (x[k] && !f[k])
      dfs(k - 1, f | f << k | f >> k | f << (m - k) | f >> (m - k),
          res * x[k] % MOD);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> t;
  for (int i = 1, A; i <= t; ++i) {
    cin >> A;
    A %= m;
    A = min(A, m - A);
    ++x[A];
  }
  dfs((m + 1) >> 1, bitset<120>(1), 1LL);
  cout << ans << endl;
  return 0;
}
