#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pi = pair<int, int>;
using pii = pair<int, pi>;
const int MAXN = 125;
using bst = bitset<MAXN>;
template <typename T>
T read() {
  T tmp;
  cin >> tmp;
  return tmp;
}
ll ans = 0, mod = 1000000007;
int n, m, k;
int cnt[MAXN];
inline bst mv(bst& x, int val, bool opt, int sz = m) {
  if (opt) {
    return (x << val) | (x >> (sz - val));
  } else {
    return (x >> val) | (x << (sz - val));
  }
}
void dfs(bst nb, int n, ll mulv) {
  ans = (ans + mulv) % mod;
  for (int i = (n); i <= (m / 2); ++i) {
    if (cnt[i] && !nb[i] && !nb[m - i]) {
      dfs(nb | mv(nb, i, true) | mv(nb, i, false), i + 1, mulv * cnt[i] % mod);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  scanf("%d%d%d", &n, &m, &k);
  memset((cnt), 0, sizeof(cnt));
  for (int i = (0); i <= (k - 1); ++i) {
    int tmp;
    scanf("%d", &tmp);
    tmp %= m;
    cnt[min(tmp, m - tmp)]++;
  }
  bst tmp = 1;
  dfs(tmp, 0, 1);
  printf("%d\n", int(ans % mod));
  return 0;
}
