#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 20;
bool visited[2][maxn];
int h[2][maxn];
bool a[2][maxn];
queue<pair<int, int> > q;
int main() {
  bool f = false;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < n; j++) {
      char ch;
      cin >> ch;
      if (ch == '-') a[i][j] = true;
    }
  visited[0][0] = true;
  q.push(make_pair(0, 0));
  h[0][0] = 0;
  while (q.size()) {
    pair<int, int> v = q.front();
    int vx = v.first;
    int vy = v.second;
    q.pop();
    if (vy + k >= n) {
      f = true;
      break;
    }
    if (h[vx][vy] > vy) continue;
    if ((a[!vx][vy + k] && !visited[!vx][vy + k]) && vy + k < n) {
      q.push(make_pair(!vx, vy + k));
      visited[!vx][vy + k] = true;
      h[!vx][vy + k] = h[vx][vy] + 1;
    }
    if (vy < n - 1 && a[vx][vy + 1] && !visited[vx][vy + 1]) {
      q.push(make_pair(vx, vy + 1));
      visited[vx][vy + 1] = true;
      h[vx][vy + 1] = h[vx][vy] + 1;
    }
    if (vy > 0 && a[vx][vy - 1] && !visited[vx][vy - 1]) {
      q.push(make_pair(vx, vy - 1));
      visited[vx][vy - 1] = true;
      h[vx][vy - 1] = h[vx][vy] + 1;
    }
  }
  if (f)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
