#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const int C = 105;
int en[C], n, m, l;
int a[1000009];
struct Matrices {
  int A[C];
  Matrices() { memset(A, 0, sizeof A); }
  Matrices operator*(Matrices B) const {
    Matrices C;
    for (int i = 0; i < m; i++)
      for (int j = 0; j < m; j++)
        C.A[(i + j) % m] =
            (C.A[(i + j) % m] + (A[i] * 1LL * B.A[j]) % 1000000007) %
            1000000007;
    return C;
  }
} cnt, st;
int main() {
  scanf("%d%d%d", &n, &l, &m);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    st.A[x % m]++;
  }
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    cnt.A[x % m]++;
    a[i] = x % m;
  }
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[i] = (a[i] + x) % m;
  }
  l--;
  l--;
  int pw = l;
  while (pw) {
    if (pw % 2) st = st * cnt;
    cnt = cnt * cnt;
    pw /= 2;
  }
  long long res = 0;
  for (int i = 0; i < m; i++)
    for (int j = 1; j <= n; j++)
      if ((i + a[j]) % m == 0)
        res = (0ll + 1ll * res + 1ll * st.A[i]) % 1000000007;
  printf("%lld", res);
}
