#include <bits/stdc++.h>
using namespace std;
int ds[2][100001];
string mmap[2];
queue<pair<int, int> > q;
int dj[] = {1, -1, 100000};
int main() {
  int n, k;
  cin >> n >> k;
  for (int first = 0; first < 2; first++) cin >> mmap[first];
  dj[2] = k;
  memset(ds, 0x3f, sizeof(ds));
  q.push(make_pair(0, 0));
  ds[0][0] = 0;
  string res = "NO";
  while (!q.empty()) {
    int ci = q.front().first;
    int cj = q.front().second;
    q.pop();
    if (cj - ds[ci][cj] < 0) continue;
    if (cj + k >= n || cj + 1 >= n) {
      res = "YES";
      break;
    }
    for (int first = 0; first < 3; first++) {
      int ni = (first != 2) ? ci : !ci;
      int nj = cj + dj[first];
      if (nj >= 0 && nj < n && mmap[ni][nj] == '-' &&
          ds[ni][nj] > ds[ci][cj] + 1) {
        ds[ni][nj] = ds[ci][cj] + 1;
        q.push(make_pair(ni, nj));
      }
    }
  }
  cout << res << endl;
  return 0;
}
