#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 1e6 + 7;
const int INF = 1e9 + 7;
int n, m;
int mid = 0;
int ile[70];
long long mnoz = 1;
long long ans = 0;
bitset<128> maska;
void backtrack(int poz = 1) {
  ans += mnoz;
  if (poz > mid) return;
  for (int i = poz; i <= mid; i++) {
    if (!ile[i]) continue;
    bitset<128> old_mask = maska;
    bitset<128> pom = (maska >> i) | (maska << (m - i));
    if ((pom & maska).count() == 0) {
      int old_mnoz = mnoz;
      maska = maska | pom;
      mnoz = mnoz * ile[i];
      if (mnoz > INF) mnoz %= INF;
      backtrack(i + 1);
      maska = old_mask;
      mnoz = old_mnoz;
    }
  }
}
void solve() {
  cin >> m >> m >> n;
  mid = (m + 1) / 2;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    temp = temp % m;
    temp = min(temp, m - temp);
    ile[temp]++;
  }
  maska[0] = 1;
  backtrack();
  cout << ans % INF << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
