#include <bits/stdc++.h>
using namespace std;
int dp[2][1005][55][55], a[1005], b[1005];
int mx(int x) { return max(0, x); };
int main() {
  int n, p, k;
  scanf("%d %d %d", &n, &p, &k);
  if (p > 2 * (n + k - 1) / k) {
    p = 2 * (n + k - 1) / k;
  }
  int z1;
  scanf("%d", &z1);
  for (int i = 1; i <= z1; i++) {
    int x;
    scanf("%d", &x);
    a[x] = 1;
  }
  int z2;
  scanf("%d", &z2);
  for (int i = 1; i <= z2; i++) {
    int x;
    scanf("%d", &x);
    b[x] = 1;
  }
  memset(dp, -0x3f, sizeof(dp));
  dp[0][0][0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= p; j++) {
      for (int x = 0; x < k; x++) {
        for (int y = 0; y < k; y++) {
          dp[i % 2][j + 1][k - 1][mx(y - 1)] =
              max(dp[i % 2][j + 1][k - 1][mx(y - 1)],
                  dp[(i + 1) % 2][j][x][y] + (a[i] || (y && b[i])));
          dp[i % 2][j + 1][mx(x - 1)][k - 1] =
              max(dp[i % 2][j + 1][mx(x - 1)][k - 1],
                  dp[(i + 1) % 2][j][x][y] + (b[i] || (x && a[i])));
          dp[i % 2][j][mx(x - 1)][mx(y - 1)] =
              max(dp[i % 2][j][mx(x - 1)][mx(y - 1)],
                  dp[(i + 1) % 2][j][x][y] + ((a[i] && x) || (b[i] && y)));
        }
      }
    }
    memset(dp[(i + 1) % 2], -0x3f, sizeof(dp[(i + 1) % 2]));
  }
  int res = 0;
  for (int j = 0; j <= p; j++) {
    for (int x = 0; x < k; x++) {
      for (int y = 0; y < k; y++) {
        res = max(res, dp[n % 2][j][x][y]);
      }
    }
  }
  printf("%d\n", res);
}
