#include <bits/stdc++.h>
const int MOD = 1E9 + 7;
const int N = 125 + 5;
const int dx[] = {-1, 1, 0, 0, -1, -1, 1, 1};
const int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
using namespace std;
int n, m, k;
int bucket[N];
long long res;
bitset<N> left(bitset<N> &x, int val, int len) {
  return (x << val) | (x >> (len - val));
}
bitset<N> right(bitset<N> &x, int val, int len) {
  return (x >> val) | (x << (len - val));
}
void dfs(bitset<N> bs, int cnt, long long pos) {
  res = (res + pos) % MOD;
  for (int i = cnt; i <= m / 2; i++) {
    if (bucket[i] && !bs[i] && !bs[m - i]) {
      long long newPos = pos * bucket[i] % MOD;
      bitset<N> newBs = bs | left(bs, i, m) | right(bs, i, m);
      dfs(newBs, i + 1, newPos);
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < k; i++) {
    int x, nx;
    scanf("%d", &x);
    x %= m;
    nx = m - x;
    int minn = min(x, nx);
    bucket[minn]++;
  }
  bitset<N> bs = 1;
  dfs(bs, 0, 1);
  res %= MOD;
  printf("%d\n", res);
  return 0;
}
