#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
long long ans = 0LL;
int n, m, t, x, cnt[120 + 1], q[6 + 1], Mod[120 << 1 | 1];
bool f[6 + 1][120 + 1];
int dfs(int p) {
  long long cur = 1LL;
  for (int i = 1; i < p; ++i) cur = cur * (long long)cnt[q[i]] % mod;
  if (p > 6) return (int)cur;
  for (int i = q[p - 1] + 1; i <= (m + 1 >> 1); ++i)
    if (cnt[i] && !f[p - 1][i] && !f[p - 1][m - i]) {
      if (p <= 5) {
        for (int j = 0; j < m; ++j) f[p][j] = 0;
        for (int j = 0; j < m; ++j)
          if (f[p - 1][j])
            f[p][j] = f[p][Mod[j + i]] = f[p][Mod[j - i + m]] = true;
      }
      q[p] = i;
      cur += dfs(p + 1);
      if (cur >= mod) cur -= mod;
    }
  return (int)cur;
}
int main() {
  scanf("%d%d%d", &n, &m, &t);
  for (int i = 1; i <= t; ++i)
    scanf("%d", &x), ++cnt[std::min(m - x % m, x % m)];
  for (int i = 0; i <= (m << 1); ++i) Mod[i] = i % m;
  f[0][0] = 1;
  ans = dfs(1);
  printf("%d\n", (int)ans);
  return 0;
}
