#include <bits/stdc++.h>
using namespace std;
int n, l, m;
int mat[17][105][105], last[105][105];
int vec[105][1];
int cost[1000005];
void mult(int r[105][105], int a[105][105], int b[105][105]) {
  int s[105][105];
  memset(s, 0, sizeof(s));
  for (int i = (0); i <= (m - 1); i += (1)) {
    for (int j = (0); j <= (m - 1); j += (1)) {
      for (int k = (0); k <= (m - 1); k += (1)) {
        s[i][j] = (0LL + s[i][j] + 1LL * a[i][k] * b[k][j]) % 1000000007;
      }
    }
  }
  memcpy(r, s, sizeof(s));
}
void mult(int r[105][1], int a[105][105], int b[105][1]) {
  int s[105][1];
  memset(s, 0, sizeof(s));
  for (int i = (0); i <= (m - 1); i += (1)) {
    for (int j = (0); j <= (0); j += (1)) {
      for (int k = (0); k <= (m - 1); k += (1)) {
        s[i][j] = (0LL + s[i][j] + 1LL * a[i][k] * b[k][j]) % 1000000007;
      }
    }
  }
  memcpy(r, s, sizeof(s));
}
int main() {
  scanf("%d %d %d", &n, &l, &m);
  memset(vec, 0, sizeof(vec));
  for (int i = (1); i <= (n); i += (1)) {
    int t;
    scanf("%d", &t);
    vec[t % m][0]++;
  }
  memset(mat[0], 0, sizeof(mat[0]));
  for (int i = (1); i <= (n); i += (1)) {
    int t;
    scanf("%d", &t);
    cost[i] = t;
    mat[0][0][(m - t % m) % m]++;
  }
  memset(last, 0, sizeof(last));
  for (int i = (1); i <= (n); i += (1)) {
    int t;
    scanf("%d", &t);
    cost[i] += t;
    last[0][(m - cost[i] % m) % m]++;
  }
  for (int i = (1); i <= (m - 1); i += (1)) {
    for (int j = (0); j <= (m - 1); j += (1)) {
      mat[0][i][j] = mat[0][i - 1][(j - 1 + m) % m];
      last[i][j] = last[i - 1][(j - 1 + m) % m];
    }
  }
  l -= 2;
  for (int i = (0); i <= (l); i += (1)) {
    if ((1 << i) > l) break;
    if (i >= 1) {
      mult(mat[i], mat[i - 1], mat[i - 1]);
    }
    if (l & (1 << i)) {
      mult(vec, mat[i], vec);
    }
  }
  mult(vec, last, vec);
  printf("%d\n", vec[0][0]);
  return 0;
}
