#include <bits/stdc++.h>
using namespace std;
char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return x * f;
}
inline long long readll() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return x * f;
}
inline void write(int x) {
  if (!x) putchar('0');
  if (x < 0) x = -x, putchar('-');
  static int sta[20];
  register int tot = 0;
  while (x) sta[tot++] = x % 10, x /= 10;
  while (tot) putchar(sta[--tot] + 48);
}
const int maxn = 200007, INF = 0x3f3f3f3f;
const int MOD = 1000000007;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const long long P = 19260817;
inline int mod1(int x) { return x < MOD ? x : x - MOD; }
inline int mod2(int x) { return x < 0 ? x + MOD : x; }
inline void add(int &x, int y) { x = mod1(x + y); }
inline void sub(int &x, int y) { x = mod2(x - y); }
int n, m, k;
long long ans = 0;
int cnt[maxn];
void dfs(int pos, bitset<120> mask, long long ways, long long flag) {
  if (flag) ans = (ans + ways) % MOD;
  if (pos > m - pos) return;
  dfs(pos + 1, mask, ways, 0);
  if (mask[pos] || mask[m - pos] || !cnt[pos]) return;
  dfs(pos + 1,
      mask | (mask << pos) | (mask >> (m - pos)) | (mask >> pos) |
          (mask << (m - pos)),
      ways * cnt[pos] % MOD, 1);
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= k; i++) {
    int x;
    scanf("%d", &x);
    x %= m;
    cnt[min(x, m - x)]++;
  }
  bitset<120> r;
  r[0] = 1;
  dfs(1, r, 1, 1);
  printf("%lld", ans);
  return 0;
}
