#include <bits/stdc++.h>
using namespace std;
const int Maxm = 120 + 5, Mod = 1000000007;
int n, m, t;
int cnt[Maxm];
int ans, mid;
void dfs(int k, long long res, bitset<Maxm> remain) {
  if (k > mid) {
    ans = (ans + res) % Mod;
    return;
  }
  dfs(k + 1, res, remain);
  if (cnt[k] && !remain[k]) {
    bitset<Maxm> bit = remain | remain << k | remain >> k | remain << (m - k) |
                       remain >> (m - k);
    dfs(k + 1, res * cnt[k] % Mod, bit);
  }
}
int main() {
  scanf("%*d%d%d", &m, &t);
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < t; ++i) {
    int x;
    scanf("%d", &x);
    x %= m;
    x = min(x, m - x);
    cnt[x]++;
  }
  ans = 0;
  mid = (m + 1) / 2;
  bitset<Maxm> bit(1);
  dfs(1, 1, bit);
  printf("%d\n", ans);
  return 0;
}
