#include <bits/stdc++.h>
using namespace std;
int n, m, t, i, j, k, a[121], ans, p = 1000000007;
bitset<120> s = 1;
void dfs(int now, bitset<120> s, int way) {
  if (now > m / 2) {
    (ans += way) %= p;
    return;
  }
  dfs(now + 1, s, way);
  if (a[now] && !s[now])
    dfs(now + 1, s | s << now | s >> now | s << m - now | s >> m - now,
        (long long)way * a[now] % p);
}
int main() {
  scanf("%d%d%d", &n, &m, &t);
  while (t--) scanf("%d", &k), k %= m, a[min(k, m - k)]++;
  dfs(0, s, 1);
  printf("%d", ans);
  return 0;
}
