#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  string a[2];
  int n, k;
  cin >> n >> k >> a[0] >> a[1];
  int d[2][100010];
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 100010; j++) d[i][j] = 1e9;
  queue<int> whi, high;
  whi.push(0);
  high.push(0);
  d[0][0] = 0;
  while (!whi.empty()) {
    int x = whi.front(), y = high.front();
    whi.pop();
    high.pop();
    if (d[x][y] > y) continue;
    if (y + k >= n) {
      puts("YES");
      return 0;
    }
    if ((a[x][y + 1] == '-') && (d[x][y + 1] == 1e9)) {
      d[x][y + 1] = d[x][y] + 1;
      whi.push(x);
      high.push(y + 1);
    }
    if ((y > 0) && (a[x][y - 1] == '-') && (d[x][y - 1] == 1e9)) {
      d[x][y - 1] = d[x][y] + 1;
      whi.push(x);
      high.push(y - 1);
    }
    if ((a[x ^ 1][y + k] == '-') && (d[x ^ 1][y + k] > (d[x][y] + 1))) {
      d[x ^ 1][y + k] = d[x][y] + 1;
      whi.push(x ^ 1);
      high.push(y + k);
    }
  }
  puts("NO");
  return 0;
}
