#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long a = 0, b = getchar(), c = 1;
  while (!isdigit(b)) c = b == '-' ? -1 : 1, b = getchar();
  while (isdigit(b)) a = a * 10 + b - '0', b = getchar();
  return a * c;
}
void print(long long x) {
  if (x < 0) putchar('-'), x = -x;
  char y = x % 10 + '0';
  if (x >= 10) print(x / 10);
  putchar(y);
}
int a[1100], b[1100];
int f[2][1100][52][52];
int main() {
  int i, j, k;
  int n, m, len;
  scanf("%d%d%d", &n, &m, &len);
  int able;
  scanf("%d", &able);
  for (i = 1; i <= able; i++) {
    scanf("%d", &j);
    a[j] = 1;
  }
  scanf("%d", &able);
  for (i = 1; i <= able; i++) {
    scanf("%d", &j);
    b[j] = 1;
  }
  m = min(m, 2 * n / len + 1);
  int x, y, cur = 0, pre = 1, add;
  for (i = 1; i <= n; i++) {
    swap(cur, pre);
    for (j = 0; j <= m; j++)
      for (x = 0; x <= len; x++)
        for (y = 0; y <= len; y++) {
          int& p = f[cur][j][x][y];
          add = (x && a[i]) || (y && b[i]);
          p = f[pre][j][x - (x > 0)][y - (y > 0)] + add;
          if (j && !x) p = max(p, f[cur][j - 1][len][y]);
          if (j && !y) p = max(p, f[cur][j - 1][x][len]);
        }
  }
  printf("%d", f[cur][m][0][0]);
}
