#include <bits/stdc++.h>
using namespace std;
int f[125], n, m, A, i, v[125];
long long ans, S;
const int MOD = 1000000007;
bitset<120> s = 1;
void dfs(int x, long long sum, bitset<120> s) {
  if (x > m / 2) {
    ans = (ans + sum) % MOD;
    return;
  }
  dfs(x + 1, sum, s);
  if (!s[x] && f[x])
    dfs(x + 1, sum * f[x] % MOD, s | s << x | s >> x | s << m - x | s >> m - x);
}
int main() {
  S = ((long long)1 << 60) - 1;
  scanf("%d", &n);
  scanf("%d%d", &m, &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &A);
    f[min(A % m, m - A % m)]++;
  }
  dfs(1, 1, s);
  cout << ans;
  return 0;
}
