#include <bits/stdc++.h>
using namespace std;
long long int n, k;
string s[2];
void BYE(string p) {
  cout << p;
  exit(0);
}
void BFS() {
  map<pair<long long int, long long int>, long long int> visit, level;
  queue<pair<long long int, long long int>> Q;
  Q.push({0, 0});
  visit[{0, 0}] = 1;
  level[{0, 0}] = 0;
  while (!Q.empty()) {
    pair<long long int, long long int> P = Q.front();
    Q.pop();
    if (P.second - 1 >= 0 && visit[{P.first, P.second - 1}] == 0 &&
        (P.second - 1) > level[P] && s[P.first][P.second - 1] == '-') {
      pair<long long int, long long int> p = {P.first, P.second - 1};
      level[p] = level[P] + 1;
      visit[p] = 1;
      Q.push(p);
    }
    if (P.second + 1 < n && visit[{P.first, P.second + 1}] == 0 &&
        (P.second + 1) > level[P] && s[P.first][P.second + 1] == '-') {
      pair<long long int, long long int> p = {P.first, P.second + 1};
      level[p] = level[P] + 1;
      visit[p] = 1;
      Q.push(p);
    }
    if (P.second + k < n && visit[{1 - P.first, P.second + k}] == 0 &&
        (P.second + k) > level[P] && s[1 - P.first][P.second + k] == '-') {
      pair<long long int, long long int> p = {1 - P.first, P.second + k};
      level[p] = level[P] + 1;
      visit[p] = 1;
      Q.push(p);
    }
    if (P.second + 1 >= n || P.second + k >= n) BYE("YES");
  }
  BYE("NO");
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k >> s[0] >> s[1];
  BFS();
}
