#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
const int inf = 1 << 30;
const long long INF = 1ll << 61;
const double oo = 1 << 30;
int n, p, k, la, ta[maxn], lb, tb[maxn];
int dp[2][maxn][51][51], ans;
void upd(int &a, int b) { a = (a > b ? a : b); }
int main() {
  scanf("%d%d%d", &n, &p, &k);
  p = min(p, 2 * (n / k + (n % k == 0 ? 0 : 1)));
  scanf("%d", &la);
  for (int i = 1; i <= la; ++i) {
    int x;
    scanf("%d", &x);
    ta[x] = 1;
  }
  scanf("%d", &lb);
  for (int i = 1; i <= lb; ++i) {
    int x;
    scanf("%d", &x);
    tb[x] = 1;
  }
  int now = 0, las = 1, tj, tk, tv;
  memset(dp[now], 0xcf, sizeof(dp[now]));
  dp[now][0][0][0] = 0;
  for (int i = 1; i <= n; ++i) {
    now = i & 1;
    las = now ^ 1;
    memset(dp[now], 0xcf, sizeof(dp[now]));
    for (int j = 0; j <= p; ++j)
      for (int a = 0; a <= k; ++a)
        for (int b = 0; b <= k; ++b) {
          tj = max(a - 1, 0);
          tk = max(b - 1, 0);
          tv = ((ta[i] && tj) || (tb[i] && tk));
          upd(dp[now][j][tj][tk], dp[las][j][a][b] + tv);
          tj = k;
          tk = max(b - 1, 0);
          tv = (ta[i] || (tb[i] && tk));
          upd(dp[now][j + 1][tj][tk], dp[las][j][a][b] + tv);
          tj = max(a - 1, 0);
          tk = k;
          tv = ((ta[i] && tj) || tb[i]);
          upd(dp[now][j + 1][tj][tk], dp[las][j][a][b] + tv);
          tj = k;
          tk = k;
          tv = (ta[i] || tb[i]);
          upd(dp[now][j + 2][tj][tk], dp[las][j][a][b] + tv);
        }
  }
  for (int i = 0; i <= 1; ++i)
    for (int j = 1; j <= p; ++j)
      for (int a = 0; a <= k; ++a)
        for (int b = 0; b <= k; ++b) ans = max(ans, dp[i][j][a][b]);
  printf("%d\n", ans);
  return 0;
}
