#include <bits/stdc++.h>
int a[2][200005];
char ca[2][200005];
using namespace std;
struct ss {
  int cnt;
  int tag;
} t1, t2, t3;
queue<struct ss> qq;
int main() {
  int n, i, j, k;
  while (scanf("%d%d", &n, &k) != EOF) {
    scanf(" %s", ca[0]);
    scanf(" %s", ca[1]);
    memset(a, -1, sizeof(a));
    a[0][0] = 0;
    while (!qq.empty()) qq.pop();
    t1.cnt = 0;
    t1.tag = 0;
    qq.push(t1);
    int res = 0;
    while (!qq.empty()) {
      t2 = qq.front();
      qq.pop();
      t3 = t2;
      t3.cnt = t2.cnt + 1;
      if (a[t3.tag][t3.cnt] == -1 && ca[t3.tag][t3.cnt] == '-' && t3.cnt < n) {
        if (a[t2.tag][t2.cnt] + 1 <= t3.cnt) {
          a[t3.tag][t3.cnt] = a[t2.tag][t2.cnt] + 1;
          qq.push(t3);
        }
      }
      t3 = t2;
      t3.cnt = t2.cnt - 1;
      if (a[t3.tag][t3.cnt] == -1 && ca[t3.tag][t3.cnt] == '-' && t3.cnt >= 0) {
        if (a[t2.tag][t2.cnt] + 1 <= t3.cnt) {
          a[t3.tag][t3.cnt] = a[t2.tag][t2.cnt] + 1;
          qq.push(t3);
        }
      }
      t3 = t2;
      t3.tag = !t2.tag;
      t3.cnt = t2.cnt + k;
      if (a[t3.tag][t3.cnt] == -1 && ca[t3.tag][t3.cnt] == '-' && t3.cnt < n) {
        if (a[t2.tag][t2.cnt] + 1 <= t3.cnt) {
          a[t3.tag][t3.cnt] = a[t2.tag][t2.cnt] + 1;
          qq.push(t3);
        }
      }
      if (t3.cnt >= n) {
        res = 1;
        break;
      }
    }
    if (a[0][n - 1] >= 0 || a[1][n - 1] >= 0) {
      res = 1;
    }
    if (res)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
