#include <bits/stdc++.h>
using namespace std;
const int maxm = 130;
const int mo = 1000000007;
int ans, n, m, t, cnt[maxm], upper;
void dfs(int nowp, int num, bitset<maxm> s, int way) {
  if (nowp > m / 2 || num == upper) return;
  dfs(nowp + 1, num, s, way);
  if (cnt[nowp] && !s[nowp]) {
    dfs(nowp + 1, num + 1,
        s | (s << nowp) | (s >> nowp) | (s << (m - nowp)) | (s >> (m - nowp)),
        (long long)way * cnt[nowp] % mo);
    ans = (ans + (long long)way * cnt[nowp]) % mo;
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &t);
  for (int a = 1; a <= t; a++) {
    int v;
    scanf("%d", &v);
    cnt[v % m]++;
  }
  for (int a = 1; a <= (m - 1) >> 1; a++) cnt[a] += cnt[m - a];
  int v = m;
  while (v) {
    upper++;
    v >>= 1;
  }
  dfs(1, 0, bitset<maxm>(1), 1);
  printf("%d\n", (ans + 1) % mo);
  return 0;
}
