#include <bits/stdc++.h>
using namespace std;
int dp[2][1005][55][55];
int a[1005], b[1005];
int n, k, p;
inline void update(int &x, int v) { x = max(x, v); }
int main() {
  scanf("%d%d%d", &n, &p, &k);
  int r;
  scanf("%d", &r);
  for (int i = 1, x; i <= r; i++) scanf("%d", &x), a[x] = 1;
  scanf("%d", &r);
  for (int i = 1, x; i <= r; i++) scanf("%d", &x), b[x] = 1;
  p = min(p, 2 * (n / k + 1));
  memset(dp, -1, sizeof(dp));
  dp[0][0][0][0] = 0;
  int now = 0;
  for (int i = 1; i <= n + 1; i++) {
    memset(dp[now ^ 1], -1, sizeof(dp[0][0]) * (p + 2));
    for (int j = 0; j <= p; j++) {
      for (int t1 = 0; t1 <= k; t1++)
        for (int t2 = 0; t2 <= k; t2++) {
          if (dp[now][j][t1][t2] < 0) continue;
          if (t1 != 0 && t2 != 0 && t1 < k && t2 < k)
            update(dp[now ^ 1][j][t1 + 1][t2 + 1],
                   dp[now][j][t1][t2] + (a[i] | b[i]));
          if (t1 != 0 && t1 < k)
            update(dp[now ^ 1][j][t1 + 1][0], dp[now][j][t1][t2] + (a[i]));
          if (t2 != 0 && t2 < k)
            update(dp[now ^ 1][j][0][t2 + 1], dp[now][j][t1][t2] + (b[i]));
          update(dp[now ^ 1][j][0][0], dp[now][j][t1][t2]);
          if (j + 1 <= p && t1 == 0)
            update(dp[now][j + 1][1][t2],
                   dp[now][j][0][t2] +
                       (t2 == 0 ? a[i - 1] : (a[i - 1] | b[i - 1]) - b[i - 1]));
          if (j + 1 <= p && t2 == 0)
            update(dp[now][j + 1][t1][1],
                   dp[now][j][t1][0] +
                       (t1 == 0 ? b[i - 1] : (a[i - 1] | b[i - 1]) - a[i - 1]));
        }
    }
    now ^= 1;
  }
  int ans = 0;
  for (int t1 = 0; t1 <= k; t1++)
    for (int t2 = 0; t2 <= k; t2++) ans = max(ans, dp[now][p][t1][t2]);
  cout << ans << endl;
  return 0;
}
