#include <bits/stdc++.h>
const int maxn = 210000;
const int maxnum = 1000000000;
struct Tdl {
  int x, y, step;
} dl[maxn + 1];
bool done[3][maxn + 1];
bool ky[3][maxn + 1];
int n, K, head, tail;
char s[maxn + 1];
bool tz(int i, int j, int step) {
  if (j > n) return true;
  if (j < 1) return false;
  if (done[i][j]) return false;
  if (step >= j) return false;
  if (!ky[i][j]) return false;
  done[i][j] = true;
  dl[++tail].x = i;
  dl[tail].y = j;
  dl[tail].step = step;
  return false;
}
int main() {
  int i, j, step;
  scanf("%d%d", &n, &K);
  for (i = 1; i <= 2; ++i) {
    scanf("%s", s);
    for (j = 1; j <= n; ++j) {
      if (s[j - 1] == '-')
        ky[i][j] = true;
      else
        ky[i][j] = false;
      done[i][j] = false;
    }
  }
  head = 0;
  tail = 1;
  dl[1].x = 1;
  dl[1].y = 1;
  dl[1].step = 0;
  done[1][1] = true;
  bool success = false;
  while (head < tail) {
    ++head;
    i = dl[head].x;
    j = dl[head].y;
    step = dl[head].step;
    success = tz(i, j + 1, step + 1);
    success = tz(i, j - 1, step + 1);
    success = tz(3 - i, j + K, step + 1);
    if (success) break;
  }
  if (success)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
