#include <bits/stdc++.h>
using namespace std;
int n, k;
string wall[2];
bool visit[2][100050];
bool escape(int s, int h, int t) {
  if (h <= t || h < 0) return false;
  if (h >= n) return true;
  if (wall[s][h] != '-') return false;
  if (visit[s][h]) return false;
  visit[s][h] = true;
  return max(max(escape(s, h + 1, t + 1), escape(s, h - 1, t + 1)),
             escape(1 - s, h + k, t + 1));
}
int main() {
  cin >> n >> k;
  cin >> wall[0];
  cin >> wall[1];
  if (escape(0, 0, -1))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
