#include <bits/stdc++.h>   using namespace std;   const long long maxN = 1e6 + 100;   const long long maxM = 1e3 + 100;   const long long mod = 1e9 + 7;   const long long hmod = 1e16 + 7;   const long double PI = 3.141592653;   const long double eps = 1e-8;   const long long D = 1379;   const long long INF = 1e18 + 20;   const long long Inf = 1e9 + 140;   void NO() {     cout <<  NO  << endl;     exit(0);   }   void YES() {     cout <<  YES  << endl;     exit(0);   }   long long n, k;   bool mrk[2][maxN], mark[2][maxN];   void dfs(long long v, long long x = 0, long long W = 0) {     if (v > n) YES();     if (v <= 0 || mrk[x][v] || mark[x][v] || v <= W) return;     mark[x][v] = true;     W++;     dfs(v + k, x ^ 1, W);     dfs(v + 1, x, W);     dfs(v - 1, x, W);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> k;     for (long long i = 1; i <= n; i++) {       char c;       cin >> c;       if (c ==  X ) mrk[0][i] = true;     }     for (long long i = 1; i <= n; i++) {       char c;       cin >> c;       if (c ==  X ) mrk[1][i] = true;     }     dfs(1);     NO();   }   