#include <bits/stdc++.h>
using namespace std;
inline int M(int x) { return (x >= 1000000007) ? (x - 1000000007) : x; }
inline int M1(int x) { return (x < 0) ? (x + 1000000007) : x; }
inline int ksm(int p, int k) {
  int res = 1;
  while (k) {
    if (k & 1) res = 1ll * res * p % 1000000007;
    k >>= 1;
    p = 1ll * p * p % 1000000007;
  }
  return res;
}
int n, m, K, a[127], ans = 0, ha;
bitset<125> st, all;
void dfs(int x, int now, bitset<125> s) {
  ans = M(ans + now);
  bitset<125> s1 = s;
  for (int i = x + 1; i < ha; i++)
    if (a[i]) {
      s = s1;
      s |= (s1 << i);
      if (s[0]) continue;
      s |= (s1 >> (m - i));
      if (s[0]) continue;
      s |= (s1 >> i);
      if (s[0]) continue;
      s |= (s1 << (m - i));
      if (s[0]) continue;
      s[i] = s[m - i] = 1;
      dfs(i, 1ll * now * a[i] % 1000000007, s);
    }
}
int main() {
  scanf("%d%d%d", &n, &m, &K);
  ha = (m >> 1) + 1;
  int i, x;
  for (i = 0; i < m; i++) all[i] = 1;
  for (i = 1; i <= K; i++) scanf("%d", &x), ++a[min(x % m, m - x % m)];
  for (i = 1; i < ha; i++)
    if (a[i]) st[i] = st[m - i] = 1, dfs(i, a[i], st), st[i] = st[m - i] = 0;
  printf("%d", M(ans + 1));
  return 0;
}
