#include <bits/stdc++.h>
const int MOD = 1E9 + 7;
const int N = 200 + 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;
bitset<N> bs[7];
int n, m, t;
long long bucket[N];
long long a[11];
long long dfs(long long cnt, long long pos) {
  long long res = 1;
  for (int i = 0; i < cnt; i++) res = res * bucket[a[i]] % MOD;
  if (cnt < 6) {
    for (int i = pos; i <= m / 2; i++) {
      if (bucket[i] && !bs[cnt][i] && !bs[cnt][m - i]) {
        a[cnt] = i;
        bs[cnt + 1] = bs[cnt];
        bs[cnt + 1] = bs[cnt + 1] | bs[cnt] << i;
        bs[cnt + 1] = bs[cnt + 1] | bs[cnt] >> i;
        bs[cnt + 1] = bs[cnt + 1] | bs[cnt] << (m - i);
        bs[cnt + 1] = bs[cnt + 1] | bs[cnt] >> (m - i);
        res = (res + dfs(cnt + 1, i + 1)) % MOD;
      }
    }
  }
  return res;
}
int main() {
  scanf("%d%d%d", &n, &m, &t);
  while (t--) {
    long long x, nx;
    scanf("%lld", &x);
    x %= m;
    nx = m - x;
    long long minn = min(x, nx);
    bucket[minn]++;
  }
  bs[0][0] = 1;
  long long res = dfs(0, 1);
  printf("%lld\n", res);
  return 0;
}
