#include <bits/stdc++.h>
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ') {
  while (!isdigit(ch = getchar()))
    if (ch == '-') f = -1;
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f * x;
}
const int N = 1e6 + 5, M = 1e2 + 5, P = 1e9 + 7;
int n, l, m;
struct Matrix {
  int __[M][M];
  int* operator[](const int _) { return __[_]; }
  Matrix() { memset(__, 0, sizeof(__)); }
  Matrix operator*(const Matrix& _) const {
    Matrix ret;
    for (int i = 0; i < m; ++i)
      for (int j = 0; j < m; ++j)
        for (int k = 0; k < m; ++k)
          ret[i][j] = (ret[i][j] + 1ll * __[i][k] * _.__[k][j] % P) % P;
    return ret;
  }
  void set() {
    for (int i = 0; i < m; ++i) __[i][i] = 1;
  }
} f, g;
int a[N], b[N], c[N], ans;
Matrix qpow(Matrix a, int b) {
  Matrix ret;
  ret.set();
  for (; b; b >>= 1, a = a * a)
    if (b & 1) ret = ret * a;
  return ret;
}
int main() {
  n = read(), l = read(), m = read();
  for (int i = 1; i <= n; ++i) a[i] = read(), ++f[0][a[i] % m];
  for (int i = 1; i <= n; ++i) b[i] = read();
  for (int i = 1; i <= n; ++i) c[i] = read();
  for (int i = 0; i < m; ++i)
    for (int j = 1; j <= n; ++j) ++g[i][(i + b[j]) % m];
  f = f * qpow(g, l - 2);
  for (int i = 1; i <= n; ++i)
    ans = (ans + f[0][(m - (b[i] + c[i]) % m) % m]) % P;
  printf("%d\n", ans);
  return 0;
}
