#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
int n, m, cnt[122];
long long ans;
struct BitSet {
  long long a, b;
  inline BitSet(long long a = 0, long long b = 0) : a(a), b(b) {}
  inline BitSet operator>>(int x) {
    BitSet ret;
    if (x < 64) {
      ret.a = (a >> x) | (b << (63 - x));
      ret.b = b >> x;
    } else {
      x -= 64;
      ret.a = b >> x;
      ret.b = 0;
    }
    return ret;
  }
  inline BitSet operator<<(int x) {
    BitSet ret;
    if (x < 64) {
      ret.b = (b << x) | (a >> (63 - x));
      ret.a = a << x;
    } else {
      x -= 64;
      ret.b = ret.a << x;
      ret.a = 0;
    }
    return ret;
  }
  inline BitSet operator|(BitSet tt) { return BitSet(a | tt.a, b | tt.b); }
  inline BitSet operator|=(BitSet tt) { return *this | tt; }
  inline int operator[](int x) {
    if (x < 64) {
      return a >> x & 1;
    } else {
      return b >> x - 64 & 1;
    }
  }
};
void dfs(int deep, int v, bitset<120> bt, long long w) {
  ans += w;
  if (1 << deep > m) {
    return;
  }
  for (int i = v; i << 1 <= m; i++) {
    if (cnt[i] && !bt[i] && !bt[m - i]) {
      dfs(deep + 1, i + 1, bt | bt << i | bt >> m - i | bt << m - i | bt >> i,
          w * cnt[i] % MOD);
    }
  }
}
inline void getInt(int &x) {
  char c;
  bool sig = 0;
  for (; c = getchar(), c < '0' || c > '9';)
    if (c == '-') sig = 1;
  for (x = c - '0'; c = getchar(), c >= '0' && c <= '9'; x = x * 10 + c - '0')
    ;
  sig && (x = -x);
}
int main() {
  getInt(n);
  getInt(m);
  int t;
  getInt(t);
  while (t--) {
    int x;
    getInt(x);
    x %= m;
    cnt[min(x, m - x)]++;
  }
  dfs(0, 1, bitset<120>(1), 1);
  printf("%lld\n", ans % MOD);
  return 0;
}
