#include <bits/stdc++.h>
using namespace std;
const int N = 1001;
const int K = 52;
bool is[2][N];
int n, p, k, dp[2][N][K][K];
void input() {
  cin >> n >> p >> k;
  for (int i = 0; i < 2; i++) {
    int r;
    cin >> r;
    while (r--) {
      int x;
      cin >> x;
      is[i][--x] = true;
    }
  }
}
int solve() {
  if (p >= (n + k - 1) / k * 2) {
    int ans = 0;
    for (int i = 0; i < n; i++) ans += (is[0][i] | is[1][i]);
    return ans;
  }
  for (int moves = 0; moves <= p; moves++) {
    bool st = moves % 2;
    for (int i = n - 1; i > -1; i--)
      for (int la = 1; la <= k; la++)
        for (int lb = 1; lb <= k; lb++) {
          int LA = min(la + 1, k), LB = min(lb + 1, k);
          int &mem = dp[st][i][la][lb];
          mem = dp[st][i + 1][LA][LB];
          if ((is[0][i] && la < k) || (is[1][i] && lb < k))
            mem = dp[st][i + 1][LA][LB] + 1;
          else {
            if (moves && is[0][i]) mem = max(mem, dp[1 - st][i + 1][1][LB] + 1);
            if (moves && is[1][i]) mem = max(mem, dp[1 - st][i + 1][LA][1] + 1);
          }
        }
  }
  return dp[p % 2][0][k][k];
}
int main() {
  input();
  cout << solve() << endl;
}
