#include <bits/stdc++.h>
using namespace std;
using namespace rel_ops;
const double PI = acos((double)-1);
int ts, ts2, ts3, ts4;
int n, m, T;
long long gcd(long long x, long long y) {
  long long t;
  for (; y != 0;) {
    t = x % y;
    x = y;
    y = t;
  }
  return x;
}
double sqr(double x) { return x * x; }
long long ans;
long long cnt[10005];
void work(int k, bitset<150> nw, long long an) {
  if (k > m / 2) {
    ans = (ans + an) % 1000000007;
    return;
  }
  work(k + 1, nw, an);
  if (!cnt[k] || nw[k]) return;
  work(k + 1, nw | (nw << k) | (nw >> k) | (nw << m - k) | (nw >> m - k),
       an * cnt[k] % 1000000007);
}
int main() {
  int i, j, k, l, t1, t2, t3, t4, t5, t6, t7, t8, t9, t, nw;
  int tt1, tt2, tt3, tt4;
  double u1, u2, u3, u4, u5, u6, u7, u8, u9;
  char c1, c2, c3;
  bitset<150> Bi;
  srand((unsigned)time(0));
  cin >> n >> m >> T;
  for (i = 1; i <= T; i++) {
    cin >> t1;
    t1 %= m;
    if (m - t1 < t1) t1 = m - t1;
    if (t1 < 0) ts = 0;
    cnt[t1]++;
  }
  work(1, bitset<150>(1), 1);
  cout << ans << endl;
  return 0;
}
