#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e5 + 5;
struct node {
  int x, l, t;
};
char a[MaxN], b[MaxN], vis1[MaxN], vis2[MaxN];
queue<node> q;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  scanf("%s %s", a + 1, b + 1);
  q.push((node){1, 1, 0});
  node nxt, now;
  while (!q.empty()) {
    now = q.front();
    q.pop();
    if (now.x + 1 > n || now.x + k > n) {
      printf("YES\n");
      return 0;
    }
    if (now.l) {
      if (now.x - 1 > 1 && a[now.x - 1] == '-' && !vis1[now.x - 1] &&
          now.t + 1 < now.x - 1) {
        nxt.x = now.x - 1, nxt.l = 1, nxt.t = now.t + 1;
        vis1[nxt.x] = 1;
        q.push(nxt);
      }
      if (a[now.x + 1] == '-') {
        nxt.x = now.x + 1, nxt.l = 1, nxt.t = now.t + 1;
        if (nxt.t < nxt.x && !vis1[nxt.x]) {
          vis1[nxt.x] = 1;
          q.push(nxt);
        }
      }
      if (b[now.x + k] == '-') {
        nxt.x = now.x + k, nxt.l = 0, nxt.t = now.t + 1;
        if (nxt.t < nxt.x && !vis2[nxt.x]) {
          vis2[nxt.x] = 1;
          q.push(nxt);
        }
      }
    } else {
      if (now.x - 1 > 1 && b[now.x - 1] == '-' && !vis2[now.x - 1] &&
          now.t + 1 < now.x - 1) {
        nxt.x = now.x - 1, nxt.l = 0, nxt.t = now.t + 1;
        vis2[nxt.x] = 1;
        q.push(nxt);
      }
      if (b[now.x + 1] == '-') {
        nxt.x = now.x + 1, nxt.l = 0, nxt.t = now.t + 1;
        if (nxt.t < nxt.x && !vis2[nxt.x]) {
          vis2[nxt.x] = 1;
          q.push(nxt);
        }
      }
      if (a[now.x + k] == '-') {
        nxt.x = now.x + k, nxt.l = 1, nxt.t = now.t + 1;
        if (nxt.t < nxt.x && !vis1[nxt.x]) {
          vis1[nxt.x] = 1;
          q.push(nxt);
        }
      }
    }
  }
  printf("NO\n");
  return 0;
}
