#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
template <typename T>
void setmax(T& x, T y) {
  x = max(x, y);
}
const int P = 1024;
const int K = 52;
const int INF = 1e9;
int dp[2][K][K][P];
int D = 0;
int main() {
  int n, p, k;
  scanf("%d%d%d", &n, &p, &k);
  vi a(n), b(n);
  for (int i = 0; i < 2; i++) {
    int len;
    scanf("%d", &len);
    while (len--) {
      int j;
      scanf("%d", &j);
      j--;
      if (i == 0)
        a[j] = 1;
      else
        b[j] = 1;
    }
  }
  for (int x = 0; x < int(k); ++x)
    for (int y = 0; y < int(k); ++y)
      for (int c = 0; c < int(p + 1); ++c) dp[D][x][y][c] = -INF;
  dp[D][0][0][0] = 0;
  for (int i = 0; i < n; i++, D ^= 1) {
    auto& T = dp[D ^ 1];
    for (int x = 0; x < int(k); ++x)
      for (int y = 0; y < int(k); ++y)
        for (int c = 0; c < int(p + 1); ++c) T[x][y][c] = -INF;
    auto& old = dp[D];
    int maxp = (i + k - 1) / k * 2;
    for (int x = 0; x < int(k); ++x)
      for (int y = 0; y < int(k); ++y)
        for (int c = 0; c < int(min(maxp + 1, p + 1)); ++c) {
          int x1 = max(0, x - 1);
          int y1 = max(0, y - 1);
          setmax(T[x1][y1][c], old[x][y][c]);
          if (x) setmax(T[x1][y1][c], old[x][y][c] + a[i]);
          if (y) setmax(T[x1][y1][c], old[x][y][c] + b[i]);
          if (c < p) {
            setmax(T[k - 1][y1][c + 1], old[x][y][c] + a[i]);
            setmax(T[x1][k - 1][c + 1], old[x][y][c] + b[i]);
          }
        }
  }
  auto& T = dp[D];
  int ans = 0;
  for (int x = 0; x < int(k); ++x)
    for (int y = 0; y < int(k); ++y)
      for (int c = 0; c < int(p + 1); ++c) ans = max(ans, T[x][y][c]);
  printf("%d\n", ans);
}
