#include #include using namespace std; bool check(vector vec, int sub){ return sub >= 0 && vec[sub]; } int main(void){ int n, k, m1, m2; cin >> n >> k; vector ds(n+1); cin >> m1; int a; for (int i = 0; i < m1; i++) { cin >> a; ds[a] = true; } vector scs(n+1); cin >> m2; int b; for (int i = 0; i < m2; i++) { cin >> b; scs[b] = true; } int dwsn = n; while (dwsn >= 0) { if (check(scs, dwsn-1) || check(scs, dwsn-k)) { cout << "Yes" << endl; return 0; } else if (check(ds, dwsn-1) && check(ds, dwsn-k)) { cout << "No" << endl; return 0; } else if (check(ds, dwsn-1)) { dwsn -= k; } else if (check(ds, dwsn-k)) { dwsn--; } else dwsn -= k; } cout << "Yes" << endl; return 0; }