#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline T1 max(T1 a, T2 b) {
  return a < b ? b : a;
}
template <typename T1, typename T2>
inline T1 min(T1 a, T2 b) {
  return a < b ? a : b;
}
const char lf = '\n';
namespace ae86 {
const int bufl = 1 << 15;
char buf[bufl], *s = buf, *t = buf;
inline int fetch() {
  if (s == t) {
    t = (s = buf) + fread(buf, 1, bufl, stdin);
    if (s == t) return EOF;
  }
  return *s++;
}
inline int ty() {
  int a = 0;
  int b = 1, c = fetch();
  while (!isdigit(c)) b ^= c == '-', c = fetch();
  while (isdigit(c)) a = a * 10 + c - 48, c = fetch();
  return b ? a : -a;
}
}  // namespace ae86
using ae86::ty;
const int _ = 123, mo = 1000000007;
int n, m, ps, cnts[_] = {0};
long long ans = 0;
bitset<_> alls;
inline bitset<_> rshl(bitset<_> a, int d) {
  d %= m;
  return ((a << d) | (a >> (m - d))) & alls;
}
inline bitset<_> rshr(bitset<_> a, int d) {
  d %= m;
  return ((a >> d) | (a << (m - d))) & alls;
}
void dfs(bitset<_> now, int las, long long d) {
  ans = (ans + d) % mo;
  for (int i = las; i + i <= m; i++)
    if (cnts[i] && !now[i] && !now[m - i])
      dfs(now | rshl(now, i) | rshr(now, i), i + 1, d * cnts[i] % mo);
}
int main() {
  ios::sync_with_stdio(0), cout.tie(nullptr);
  n = ty(), m = ty(), ps = ty();
  for (int i = 1; i <= ps; i++) {
    int a = ty() % m;
    cnts[min(a, m - a)]++;
  }
  bitset<_> temp = 0;
  temp[0] = 1;
  alls = 0;
  for (int i = 0; i < m; i++) alls[i] = 1;
  dfs(temp, 0, 1), cout << ans << lf;
  return 0;
}
