#include <bits/stdc++.h>
using namespace std;
int F[10000];
char w[2][1000000];
int mt[2][1000000];
int main() {
  int n, k;
  scanf("%d %d\n", &n, &k);
  gets(w[0]);
  w[0][n] = '-', w[0][n + 1] = 0;
  gets(w[1]);
  w[1][n] = '-', w[1][n + 1] = 0;
  memset(mt, 0x7f, sizeof(mt));
  mt[0][0] = 0;
  std::priority_queue<std::pair<int, std::pair<int, int> > > Q;
  Q.push(std::pair<int, std::pair<int, int> >(0, std::pair<int, int>(0, 0)));
  bool ok = false;
  while (!Q.empty()) {
    int t = -Q.top().first;
    int p = Q.top().second.first;
    int h = Q.top().second.second;
    Q.pop();
    if (h >= n) {
      printf("YES\n");
      return 0;
    }
    if (t <= h) {
      if (h + 1 >= n || w[p][h + 1] == '-') {
        if (t + 1 < mt[p][h + 1]) {
          mt[p][h + 1] = t + 1;
          Q.push(std::pair<int, std::pair<int, int> >(
              -t - 1, std::pair<int, int>(p, h + 1)));
        }
      }
      if (h > 0 && w[p][h - 1] == '-') {
        if (t + 1 < mt[p][h - 1]) {
          mt[p][h - 1] = t + 1;
          Q.push(std::pair<int, std::pair<int, int> >(
              -t - 1, std::pair<int, int>(p, h - 1)));
        }
      }
      if (h + k >= n || w[1 - p][h + k] == '-') {
        if (t + 1 < mt[1 - p][h + k]) {
          mt[1 - p][h + k] = t + 1;
          Q.push(std::pair<int, std::pair<int, int> >(
              -t - 1, std::pair<int, int>(1 - p, h + k)));
        }
      }
    }
  }
  printf("NO\n");
  return 0;
}
