#pragma GCC optimize("Ofast") #include using namespace std; typedef long long int ll; typedef unsigned long long int ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } inline double time() { return static_cast(chrono::duration_cast(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,k; cin >> n >> k; vector a(n+1, -1); int m; cin >> m; for (int i = 0; i < m; ++i) { int b; cin >> b; a[b] = 1; } cin >> m; for (int i = 0; i < m; ++i) { int b; cin >> b; a[b] = 0; } vector> dp(2, vector(n+1)); dp[0][0] = 1; for (int i = 0; i < n; ++i) { for (int j = 0; j < 2; ++j) { if (!dp[j][i]) continue; { int nxt = j; if (a[i+1] != -1) nxt = a[i+1]; dp[nxt][i+1] = 1; } if (i+k <= n) { int nxt = j; if (a[i+k] != -1) nxt = a[i+k]; dp[nxt][i+k] = 1; } } } if (dp[0][n]) { cout << "Yes" << endl; } else { cout << "No" << endl; } }