#include <bits/stdc++.h>
using namespace std;
queue<pair<long long, long long> > q;
int main() {
  char ar[2][100004];
  long long use[2][100004];
  long long i, n, k, c, r;
  scanf("%lld%lld", &n, &k);
  for (i = 0; i < 2; i++) scanf("%s", ar[i]);
  memset(use, -1, sizeof(use));
  use[0][0] = 0;
  q.push(make_pair(0, 0));
  while (!q.empty()) {
    pair<long long, long long> cur = q.front();
    q.pop();
    r = cur.first;
    c = cur.second;
    if (c < use[r][c]) continue;
    if (c + k >= n) {
      printf("YES\n");
      return 0;
    }
    if (c < n - 1 && use[r][c + 1] == -1 && ar[r][c + 1] == '-') {
      q.push(make_pair(r, c + 1));
      use[r][c + 1] = use[r][c] + 1;
    }
    if (c && use[r][c - 1] == -1 && ar[r][c - 1] == '-') {
      q.push(make_pair(r, c - 1));
      use[r][c - 1] = use[r][c] + 1;
    }
    if (ar[!r][c + k] == '-' && use[!r][c + k] == -1) {
      q.push(make_pair(!r, c + k));
      use[!r][c + k] = use[r][c] + 1;
    }
  }
  printf("NO\n");
  return 0;
}
