#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int t1[maxn], t2[maxn];
int q[maxn * 2], tail, cur, n, k;
char s1[maxn], s2[maxn];
int bfs() {
  memset(t1, 0xff, sizeof(t1));
  memset(t2, 0xff, sizeof(t2));
  q[1] = 1 * maxn + 1, cur = 0, tail = 1, t1[1] = 0;
  while (cur < tail) {
    int now = q[++cur];
    int t = now / maxn;
    int r = now % maxn;
    if (r + k > n) return 1;
    if (t == 1) {
      if (r - t1[r] > 2 && r > 1 && t1[r - 1] == -1 && s1[r - 1] == '-') {
        q[++tail] = 1 * maxn + (r - 1);
        t1[r - 1] = t1[r] + 1;
      }
      if (r < n && t1[r + 1] == -1 && s1[r + 1] == '-') {
        q[++tail] = 1 * maxn + (r + 1);
        t1[r + 1] = t1[r] + 1;
      }
      if (r + k <= n && t2[r + k] == -1 && s2[r + k] == '-') {
        q[++tail] = 2 * maxn + (r + k);
        t2[r + k] = t1[r] + 1;
      }
    } else {
      if (r - t2[r] > 2 && r > 1 && t2[r - 1] == -1 && s2[r - 1] == '-') {
        q[++tail] = 2 * maxn + (r - 1);
        t2[r - 1] = t2[r] + 1;
      }
      if (r < n && t2[r + 1] == -1 && s2[r + 1] == '-') {
        q[++tail] = 2 * maxn + (r + 1);
        t2[r + 1] = t2[r] + 1;
      }
      if (r + k <= n && t1[r + k] == -1 && s1[r + k] == '-') {
        q[++tail] = 1 * maxn + (r + k);
        t1[r + k] = t2[r] + 1;
      }
    }
  }
  return 0;
}
int main() {
  while (scanf("%d %d", &n, &k) != EOF) {
    scanf("%s", s1 + 1);
    scanf("%s", s2 + 1);
    if (bfs())
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
