#include <bits/stdc++.h>
using namespace std;
long long MAX = 1000000007;
vector<long long> f(vector<long long> v, vector<long long> pt, long long m) {
  vector<long long> v1(v.size());
  for (int j = 0; j < m; j++) {
    for (int k = 0; k < m; k++) {
      v1[(j + k) % m] += (v[j] * pt[k]) % MAX;
    }
  }
  for (int j = 0; j < m; j++) {
    v1[j] %= MAX;
  }
  return v1;
}
int main() {
  ios_base::sync_with_stdio(false);
  long long n, l, m, s;
  cin >> n >> l >> m;
  vector<long long> pt(m);
  vector<long long> v(m);
  vector<long long> v1(m);
  vector<long long> end(m);
  vector<long long> tmp(n);
  vector<long long> zzz(n);
  for (int i = 0; i < n; i++) {
    cin >> s;
    v[s % m]++;
  }
  for (int i = 0; i < n; i++) {
    cin >> tmp[i];
    v1[tmp[i] % m]++;
  }
  for (int i = 0; i < n; i++) {
    cin >> zzz[i];
  }
  l--;
  l--;
  pt[0] = 1;
  while (l) {
    if (l % 2) {
      pt = f(pt, v1, m);
    }
    v1 = f(v1, v1, m);
    l /= 2;
  }
  v1 = f(pt, v, m);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += v1[(2 * m - tmp[i] - zzz[i]) % m];
  }
  cout << ans % MAX;
}
