#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 120;
bitset<MAXN + 6> s;
int ans;
int cntv[MAXN + 6];
int t, m, n;
void DFS(bitset<MAXN + 6> a, int cur, long long mulv) {
  ans = (ans + mulv) % MOD;
  for (int i = cur; i <= (m >> 1); ++i)
    if (cntv[i] && !a[i] && !a[m - i])
      DFS(a | a << i | a >> i | a << m - i | a >> m - i, i + 1,
          mulv * cntv[i] % MOD);
  return;
}
int main() {
  scanf("%d%d%d", &t, &m, &n);
  for (register int i = n, j; i >= 1; --i) {
    scanf("%d", &j);
    j %= m;
    cntv[min(j, m - j)]++;
  }
  s[0] = 1;
  DFS(s, 1, 1);
  printf("%lld", ans);
  return 0;
}
