#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int M = 123;
int c[M];
int m;
int res = 1;
vector<int> v;
void gen(int i, int q, const bitset<120>& b) {
  if (i == (int)v.size()) return;
  int x = v[i];
  gen(i + 1, q, b);
  if (!b[x] && !b[m - x]) {
    q = (long long)q * c[x] % MOD;
    res += q;
    if (res >= MOD) res -= MOD;
    gen(i + 1, q, b | (b << x) | (b >> x) | (b >> (m - x)) | (b << (m - x)));
  }
}
int main() {
  int n;
  scanf("%d%d%d", &m, &m, &n);
  while (n--) {
    int x;
    scanf("%d", &x);
    x %= m;
    if (x > m - x) x = m - x;
    ++c[x];
  }
  for (int i = 1; i < m; ++i)
    if (c[i] > 0) v.push_back(i);
  bitset<120> b(1);
  gen(0, 1, b);
  printf("%d\n", res);
  return 0;
}
