#include <bits/stdc++.h>
using namespace std;
const int DIM = 120;
const int MOD = 1000000007;
int frq[DIM];
int ans = 0, _m;
void back(int p, bitset<DIM> bit, int nr) {
  if (p > _m / 2) {
    ans = (ans + nr) % MOD;
  } else {
    back(p + 1, bit, nr);
    if (frq[p] and !bit[p]) {
      bit |= (bit << p) | (bit >> p) | (bit << (_m - p)) | (bit >> (_m - p));
      back(p + 1, bit, 1LL * nr * frq[p] % MOD);
    }
  }
}
int main(void) {
  int n, m, t, v;
  cin >> n >> m >> t;
  _m = m;
  while (t--) {
    int x;
    cin >> x;
    ++frq[min(x % m, m - (x % m))];
  }
  back(0, bitset<DIM>(1), 1);
  cout << ans << endl;
  return 0;
}
