#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int n, m, t, cnt[127];
long long ans;
void DFS(int u, bitset<127> st, long long res) {
  if (u > m / 2)
    (ans += res) %= MOD;
  else {
    DFS(u + 1, st, res);
    if (cnt[u] && !st[u])
      DFS(u + 1, st | st << u | st >> (m - u) | st >> u | st << (m - u),
          res * cnt[u] % MOD);
  }
}
int main() {
  cin >> n >> m >> t;
  for (int i = 1; i <= t; ++i) {
    int x;
    cin >> x;
    x %= m;
    x = min(x, m - x);
    ++cnt[x];
  }
  DFS(1, bitset<127>(1), 1);
  cout << ans;
}
