#include <bits/stdc++.h>
using namespace std;
int cnt[130];
int n, m, k;
bitset<120> st;
inline int add(int &u, int v) {
  u += v;
  if (u >= 1000000007) u -= 1000000007;
}
int ma = 0;
int xx = 0;
int calc(bitset<120> &st, int tot) {
  if (tot > ma) return 1;
  int ans = calc(st, tot + 1);
  if (cnt[tot] and !st[tot]) {
    bitset<120> res = st;
    res = res | (st >> tot) | (st << tot) | (st >> m - tot) | (st << m - tot);
    xx++;
    add(ans, (long long)calc(res, tot + 1) * cnt[tot] % 1000000007);
  }
  return ans;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= k; i++) {
    int u;
    scanf("%d", &u);
    u %= m;
    cnt[min(u, m - u)]++;
    ma = max(ma, min(u, m - u));
  }
  st.set(0);
  cout << calc(st, 1) << endl;
}
