#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 0;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar()) f ^= (ch == '-');
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  return f ? -x : x;
}
const long long mod = 1e9 + 7;
long long n, m, t, tot[125], a[15];
bitset<125> s[7];
long long dfs(long long cnt, long long pos) {
  long long ans = 1;
  for (long long i = 0; i < cnt; ++i) ans = ans * tot[a[i]] % mod;
  if (cnt < 6) {
    for (long long i = pos; i <= m / 2; ++i) {
      if (!tot[i] || s[cnt][i] || s[cnt][m - i]) continue;
      a[cnt] = i;
      s[cnt + 1] = s[cnt];
      s[cnt + 1] |= s[cnt] << i;
      s[cnt + 1] |= s[cnt] >> i;
      s[cnt + 1] |= s[cnt] << (m - i);
      s[cnt + 1] |= s[cnt] >> (m - i);
      ans = (ans + dfs(cnt + 1, i + 1)) % mod;
    }
  }
  return ans;
}
signed main() {
  n = read();
  m = read();
  t = read();
  for (long long i = 1, x; i <= t; ++i) {
    x = read() % m;
    x = min(x, m - x);
    ++tot[x];
  }
  s[0][0] = 1;
  printf("%lld\n", dfs(0, 1));
  return 0;
}
