#include <bits/stdc++.h>
using namespace std;
bitset<120> s = 1;
int cnt[120], a[120], next[120], n, m, ans = 0, ss = 0;
void dfs(int xx, const bitset<120> &s, int sum) {
  ++ss;
  if (xx > (m >> 1)) {
    ans = (ans + sum) % 1000000007;
    return;
  }
  dfs(xx + 1, s, sum);
  int x = a[xx];
  if (cnt[x] && !s[x])
    dfs(xx + 1, s | s << x | s >> x | s << m - x | s >> m - x,
        (long long)sum * cnt[x] % 1000000007);
}
int count(int x) {
  int res = 0;
  for (int i = 1; i <= x; ++i) res += (x % i == 0);
  return res;
}
bool cmp(int x, int y) { return count(x) > count(y); }
int main() {
  int t, x;
  scanf("%d%d%d", &n, &m, &t);
  for (int i = 1; i <= t; ++i) scanf("%d", &x), x %= m, ++cnt[min(x, m - x)];
  for (int i = 0; i <= (m >> 1); ++i) a[i] = i;
  srand(time(0));
  random_shuffle(a + 1, a + 1 + (m >> 1));
  sort(a + 1, a + 1 + (m >> 1), cmp);
  dfs(0, s, 1);
  printf("%d\n", ans);
  return 0;
}
