#include <bits/stdc++.h>
using namespace std;
long long mas[71], ans, base = 1000000007;
int n, m, fin;
bitset<121> st;
inline void dfs(int t, bitset<121> x, long long c) {
  if (t == fin) {
    ans += c;
    ans %= base;
    return;
  }
  dfs(t + 1, x, c);
  if (mas[t] == 0 || x[t] == 1 || x[m - t] == 1) return;
  x = x | (x >> t) | (x << t) | (x >> (m - t)) | (x << (m - t));
  dfs(t + 1, x, c * mas[t] % base);
}
int main() {
  scanf("%d%d%d", &n, &m, &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    x %= m;
    mas[min(x, m - x)]++;
  }
  fin = m / 2 + 1;
  st[0] = 1;
  dfs(0, st, 1);
  cout << ans << endl;
  return 0;
}
