#include <bits/stdc++.h>
using namespace std;
long long int ans, c[121][121];
int n, m, t, cnt[121];
void dfs(bitset<120> S, int i, long long int num) {
  bitset<120> S1;
  if (i > m / 2) {
    ans += num;
    ans %= 1000000007;
    return;
  }
  if (!S[i] && cnt[i]) {
    S1 = S;
    S1[i] = 1;
    S1 |= (S << i);
    S1 |= (S >> (m - i));
    S1 |= (S >> i);
    S1 |= (S << (m - i));
    dfs(S1, i + 1, (num * cnt[i]) % 1000000007);
  }
  dfs(S, i + 1, num);
}
int main() {
  scanf("%d%d%d", &n, &m, &t);
  int i, j;
  for (i = 1; i <= t; i++) {
    scanf("%d", &j);
    j %= m;
    j = min(j, m - j);
    cnt[j]++;
  }
  bitset<120> S;
  for (i = 0; i < 120; i++) S[i] = 0;
  S[0] = 1;
  dfs(S, 1, 1);
  cout << ans;
}
