#include <bits/stdc++.h>
using namespace std;
const int op = 1000000007;
int n, m, M;
int a[120], f[120], ans = 0;
long long e[120];
void dfs(const long long now, const int A, const int y) {
  ans += A;
  while (ans >= op) ans -= op;
  if (now + 1 == e[M + 1]) return;
  for (int i = y + 1; i <= M; ++i)
    if (a[i] > 0 && (now & e[i]) == 0) {
      long long Q = 0;
      for (int j = 0; j <= M; ++j)
        if ((now & e[j]) > 0) Q |= e[j] | e[abs(j - i)] | e[f[i + j]];
      dfs(Q, (long long)A * (a[i]) % op, i);
    }
}
void init() {
  scanf("%*d%d%d", &m, &n);
  for (int i = 1, x; i <= n; ++i) scanf("%d", &x), x %= m, ++a[min(x, m - x)];
  M = m / 2;
  e[0] = 1;
  for (int i = 0; i <= M; ++i) f[i] = i;
  for (int i = M + 1; i <= m; ++i) f[i] = m - i;
  for (int i = 1; i <= M; ++i) e[i] = e[i - 1] << 1;
  e[M + 1] = e[M] << 1;
}
int main() {
  init();
  dfs(1, 1, 0);
  printf("%d\n", ans);
  return 0;
}
