#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double eps = 1e-7;
const int inf = 1000000010;
const long long INF = 10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 1010, K = 51;
int n, m, k, u, v, x, y, t, a, b, ans;
short dp[2][MAXN][K][K];
bool good[2][MAXN];
inline void upd(short &a, short b) { a = max(a, b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < 2; i++) {
    cin >> t;
    while (t--) cin >> x, good[i][x] = 1;
  }
  m = min(m, 2 * n / k + 2);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int x = 0; x <= k; x++)
        for (int y = 0; y <= k; y++) {
          int tmp = (x && good[0][i]) || (y && good[1][i]);
          upd(dp[1][j][x][y], dp[0][j][max(x - 1, 0)][max(y - 1, 0)] + tmp);
          if (j) {
            upd(dp[1][j][x][y], dp[1][j - 1][k][y]);
            upd(dp[1][j][x][y], dp[1][j - 1][x][k]);
          }
        }
    }
    for (int j = 0; j <= m; j++)
      for (int x = 0; x <= k; x++)
        for (int y = 0; y <= k; y++) {
          dp[0][j][x][y] = dp[1][j][x][y];
          dp[1][j][x][y] = 0;
        }
  }
  cout << dp[0][m][0][0] << '\n';
  return 0;
}
