#include <bits/stdc++.h>
using namespace std;
char str[2][100005];
int p[3][2] = {0, 1, 0, -1, 1};
int n;
struct node {
  int x, y, step;
  bool check() {
    if (x >= 0 && y >= 0 && x < 2 && y < n) return true;
  }
} s, u, e, v;
bool bfs() {
  queue<node> q;
  bool vis[2][100005];
  memset(vis, false, sizeof(vis));
  vis[s.x][s.y] = true;
  q.push(s);
  while (!q.empty()) {
    u = q.front();
    q.pop();
    for (int i = 0; i < 3; i++) {
      v = u;
      v.x = (v.x + p[i][0]) % 2;
      v.y += p[i][1];
      v.step++;
      if (v.y >= n) return true;
      if (v.check() && v.y >= v.step && str[v.x][v.y] == '-' &&
          vis[v.x][v.y] == false) {
        vis[v.x][v.y] = true;
        q.push(v);
      }
    }
  }
  return false;
}
int main() {
  int k;
  while (~scanf("%d%d", &n, &k)) {
    scanf("%s%s", str[0], str[1]);
    p[2][1] = k;
    s.x = 0, s.y = 0, s.step = 0;
    if (bfs())
      printf("YES\n");
    else
      printf("NO\n");
  }
}
