#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e, f[155], g[10005], h, i, j;
int an;
bitset<150> T;
void soso(int x, bitset<150> y, long long z) {
  int ii, jj, kk;
  if (x > (b + 1) >> 1) {
    an += z;
    an %= 1000000007;
    return;
  }
  soso(x + 1, y, z);
  if (f[x] && !y[x])
    soso(x + 1, y | (y << x) | (y >> x) | (y << b - x) | (y >> b - x),
         (z * (long long)f[x]) % 1000000007);
}
int main() {
  scanf("%d%d%d", &a, &b, &c);
  for (i = 1; i <= c; i++) scanf("%d", &g[i]);
  for (i = 1; i <= c; i++) g[i] %= b;
  for (i = 1; i <= c; i++) g[i] = min(g[i], b - g[i]);
  for (i = 1; i <= c; i++) f[g[i]]++;
  T[0] = 1;
  soso(1, T, 1LL);
  printf("%I64d\n", an);
  return 0;
}
