#include <bits/stdc++.h>
using namespace std;
const int maxm = 120, maxdm = maxm / 2 + 1;
int cnt[maxdm];
int used[maxdm];
int backup[maxdm][maxdm];
int precsum[maxdm][maxdm];
int precdif[maxdm][maxdm];
int m, dm;
const int MOD = (int)1e9 + 7;
int ans;
void solve(int it, int curtimes) {
  if (!curtimes) return;
  if (it == dm) {
    ans += curtimes;
    if (ans >= MOD) ans -= MOD;
    return;
  }
  if (!used[it]) {
    for (int i = 0; i < dm; i++) backup[it][i] = used[i];
    for (int i = 0; i < dm; i++)
      if (backup[it][i]) {
        used[precsum[i][it]] = 1;
        used[precdif[i][it]] = 1;
      }
    used[it] = 1;
    solve(it + 1, ((long long)curtimes * cnt[it]) % MOD);
    for (int i = 0; i < dm; i++) used[i] = backup[it][i];
  }
  solve(it + 1, curtimes);
}
int main() {
  int n, t;
  while (scanf("%d%d%d", &n, &m, &t) >= 1) {
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < t; i++) {
      int x;
      scanf("%d", &x);
      cnt[min(x % m, m - (x % m))]++;
    }
    dm = m / 2 + 1;
    for (int i = 0; i < dm; i++)
      for (int j = 0; j < dm; j++) {
        precsum[i][j] = min(i + j, m - (i + j));
        precdif[i][j] = (i - j + m) % m;
        precdif[i][j] = min(precdif[i][j], m - precdif[i][j]);
      }
    memset(used, 0, sizeof(used));
    ans = 0;
    solve(1, 1);
    printf("%d\n", ans);
  }
  return 0;
}
