#include <bits/stdc++.h>
using namespace std;
const int N = 260;
const int MOD = 1000000000 + 7;
int n, m, t;
int mid;
int v[N], mod[N];
bool g[10][N];
long long ans, f[10];
inline void Dfs(int k, int d) {
  ans += f[d];
  if (ans > MOD) ans -= MOD;
  if (d > 5) return;
  for (int i = k; i <= mid; i++)
    if (v[i] && !g[d][i] && !g[d][m - i]) {
      if (d < 5) {
        for (int j = 0; j < m; j++) g[d + 1][j] = g[d][j];
        for (int j = 0; j < m; j++)
          if (g[d][j]) g[d + 1][mod[j + i]] = g[d + 1][mod[j + m - i]] = 1;
      }
      f[d + 1] = (f[d] * v[i]) % MOD;
      Dfs(i + 1, d + 1);
    }
}
int main() {
  int x;
  for (scanf("%d %d %d", &n, &m, &t); t--; v[((x) < (m - x) ? (x) : (m - x))]++)
    scanf("%d", &x), x %= m;
  mid = m / 2;
  for (int i = 0; i <= 2 * m; i++) mod[i] = i % m;
  f[0] = 1;
  g[0][0] = 1;
  Dfs(1, 0);
  printf("%d\n", (int)ans);
  return 0;
}
