#include <bits/stdc++.h>
namespace my_std {
using namespace std;
inline int read() {
  int ans = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    f ^= (c == '-');
    c = getchar();
  }
  for (; isdigit(c); c = getchar()) ans = (ans << 1) + (ans << 3) + (c ^ 48);
  return f ? ans : -ans;
}
const int mod = 1000000007, M = 128;
inline void inc(int &x, const int &y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline int ksm(int x, long long y) {
  int res = 1;
  for (; y; y >>= 1, x = 1ll * x * x % mod)
    if (y & 1) res = 1ll * res * x % mod;
  return res;
}
inline int gcd(int x, int y) {
  if (x < y) swap(x, y);
  return y ? gcd(y, x % y) : x;
}
}  // namespace my_std
using namespace my_std;
int num[M], m, n, siz, ans;
inline void dfs(int tem, int lef, bitset<M> B) {
  if (!tem) return;
  inc(ans, tem);
  register bitset<M> W;
  for (register int i = (lef); i <= (siz); ++i)
    if (num[i] && !B[i]) {
      W = B;
      W |= (B << i) | (B >> (m - i));
      W |= (B >> i) | (B << (m - i));
      W[i] = W[m - i] = 1;
      if ((int)W[0]) continue;
      dfs(1ll * tem * num[i] % mod, i + 1, W);
    }
  return;
}
int main() {
  read(), m = read(), n = read();
  for (register int i = (1); i <= (n); ++i) num[read() % m]++;
  for (register int i = (1); i <= ((m - 1) >> 1); ++i) num[i] += num[m - i];
  siz = m >> 1;
  dfs(1, 1, 0);
  printf("%d\n", ans);
  return 0;
}
