#include <bits/stdc++.h>
using namespace std;
bitset<122> s[8];
int cnt[122], num[8], n, m, t;
const long long mod = 1e9 + 7;
long long dfs(int dep, int lst) {
  long long res = 1;
  for (int i = 0; i < dep; i++) res = (1ll * res * cnt[num[i]]) % mod;
  if (dep > 5) return res;
  for (int i = lst; i <= m / 2; i++) {
    if (!cnt[i] || s[dep][i] || s[dep][m - i]) continue;
    num[dep] = i;
    s[dep + 1] = s[dep];
    s[dep + 1] |= (s[dep] << i) | (s[dep] >> i);
    s[dep + 1] |= (s[dep] << (m - i)) | (s[dep] >> (m - i));
    res = (res + dfs(dep + 1, i + 1)) % mod;
  }
  return res;
}
int main() {
  scanf("%d%d%d", &n, &m, &t);
  for (int x, i = 1; i <= t; i++) {
    scanf("%d", &x);
    x %= m;
    cnt[min(x, m - x)]++;
  }
  s[0][0] = 1;
  printf("%lld", dfs(0, 1));
}
