#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
bitset<130> S;
int A[10000 + 10], cnt[10000 + 10];
int ans = 0;
int m;
void dfs(int i, bitset<130> S, int w) {
  if (i > m / 2) {
    ans = (ans + w) % mod;
    return;
  }
  dfs(i + 1, S, w);
  if (S[i] == 0 && S[m - i] == 0 && cnt[i]) {
    int W = 1LL * w * cnt[i] % mod;
    dfs(i + 1, S | S << i | S >> (m - i) | S << (m - i) | S >> i, W);
  }
}
int main() {
  int n, t, i;
  scanf("%d%d%d", &n, &m, &t);
  for (i = 1; i <= t; i++) {
    scanf("%d", &A[i]);
    A[i] %= m;
    if (A[i] * 2 > m) A[i] = m - A[i];
    cnt[A[i]]++;
  }
  S[0] = 1;
  dfs(1, S, 1);
  printf("%d\n", ans);
}
