#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T poww(T b, T p) {
  long long a = 1;
  while (p) {
    if (p & 1) {
      a = (a * b);
    }
    p >>= 1;
    b = (b * b);
  }
  return a;
}
template <class T>
inline T gcd(T a, T b) {
  if (b > a) return gcd(b, a);
  return ((b == 0) ? a : gcd(b, a % b));
}
int n, p, k;
const int maxN = 1001;
int answered[3][maxN];
short int dp[maxN][maxN][51][2];
inline short getsm(int s, int e, int genius) {
  return answered[genius][e] - answered[genius][s - 1];
}
inline short getsmBoth(int s, int e) {
  return answered[2][e] - answered[2][s - 1];
}
short solve(int ques, int glances, int kleft, int genius) {
  if (!ques) {
    return 0;
  }
  short& ans = dp[ques][glances][kleft][genius];
  if (ans != -1) return ans;
  ans = 0;
  if (!kleft) {
    ans = max(ans, solve(ques - 1, glances, 0, genius));
    if (glances) {
      int maxdist = min(k, ques);
      ans = max(ans, solve(ques, glances - 1, maxdist, genius));
      ans = max(ans, solve(ques, glances - 1, maxdist, !genius));
    }
  } else {
    ans = max<short>(ans, solve(ques - 1, glances, kleft - 1, genius) +
                              getsm(ques, ques, genius));
    if (glances)
      ans = max<short>(
          ans, solve(ques - kleft, glances - 1, min(k, ques) - kleft, !genius) +
                   getsmBoth(ques - kleft + 1, ques));
  }
  return ans;
}
int main() {
  int i, j;
  cin >> n >> p >> k;
  int r1, r2;
  cin >> r1;
  for ((i) = 0; (i) < (r1); (i)++) {
    cin >> j;
    answered[0][j] = 1;
  }
  cin >> r2;
  for ((i) = 0; (i) < (r2); (i)++) {
    cin >> j;
    answered[1][j] = 1;
  }
  for ((i) = (1); (i) < (n + 1); (i) += 1)
    answered[2][i] = answered[0][i] | answered[1][i];
  for ((j) = 0; (j) < (3); (j)++)
    for ((i) = (1); (i) < (n + 1); (i) += 1) {
      answered[j][i] += answered[j][i - 1];
    }
  memset(dp, -1, sizeof(dp));
  cout << solve(n, p, 0, 0) << endl;
}
