#include <bits/stdc++.h>
using namespace std;
int cnt[120], N, M, K;
int calc(int dp, bitset<120> s, int cur) {
  if (dp > M / 2) return cur;
  int ans = calc(dp + 1, s, cur);
  if (cnt[dp] && !s[dp])
    ans += calc(dp + 1,
                s | (s >> dp) | (s << dp) | (s >> (M - dp)) | (s << (M - dp)),
                (long long)cur * cnt[dp] % 1000000007);
  ans %= 1000000007;
  return ans;
}
int main() {
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 0; i < K; i++) {
    int x;
    scanf("%d", &x);
    x %= M;
    cnt[min(x, M - x)]++;
  }
  printf("%d\n", calc(0, bitset<120>(1), 1));
  return 0;
}
