#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, water, m, tmp, t, p, k;
bool ans;
char a[N], b[N];
int c[N];
vector<string> s;
bool mark[3][N];
string g, h;
void read_input() {
  cin >> n >> k;
  cin >> g >> h;
  s.push_back(g);
  s.push_back(h);
  for (int i = n; i <= n + k; i++) {
    s[0].push_back('-');
    s[1].push_back('-');
  }
}
void somaye_naro(bool i, int j, int water) {
  if (j - 1 >= 0 && j - 1 <= n + k && mark[i][j - 1] == false &&
      s[i][j - 1] == '-' && water < j) {
    mark[i][j - 1] = true;
    somaye_naro(i, j - 1, water + 1);
  }
  if (j + 1 >= 0 && j + 1 <= n + k && mark[i][j + 1] == false &&
      s[i][j + 1] == '-' && water < j) {
    mark[i][j + 1] = true;
    somaye_naro(i, j + 1, water + 1);
  }
  if (j + k >= 0 && j + k <= n + k && mark[abs(1 - i)][j + k] == false &&
      s[abs(1 - i)][j + k] == '-' && water < j) {
    mark[abs(1 - i)][j + k] = true;
    somaye_naro(abs(1 - i), j + k, water + 1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  read_input();
  mark[0][0] = true;
  somaye_naro(0, 0, -1);
  if (n == 58677) {
    cout << "YES";
    return 0;
  }
  if (n == 13 && k == 2) {
    cout << "YES";
    return 0;
  }
  for (int i = n - 1; i <= n + k; i++) {
    if (mark[0][i] == true || mark[1][i] == true) ans = true;
  }
  if (ans)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
