#include <bits/stdc++.h>
using namespace std;
int n;
string wall[2];
vector<pair<int, int> > dirs = {make_pair(0, -1), make_pair(0, 1)};
bool reached[2][100010];
int waterHeight[2][100010];
inline bool isValid(int x, int y) {
  return 0 <= x and x <= 1 and 0 <= y and y < n;
}
int main() {
  int k;
  cin >> n >> k;
  cin >> wall[0] >> wall[1];
  assert(wall[0][0] == '-');
  dirs.push_back(make_pair(1, k));
  queue<pair<int, int> > Q;
  Q.push(make_pair(0, 0));
  waterHeight[0][0] = 0;
  reached[0][0] = true;
  bool possible = false;
  while (!Q.empty()) {
    pair<int, int> curr = Q.front();
    Q.pop();
    if (curr.second < waterHeight[curr.first][curr.second]) continue;
    for (pair<int, int> dir : dirs) {
      int x = curr.first ^ dir.first;
      int y = curr.second + dir.second;
      if (y >= n) {
        possible = true;
        break;
      }
      if (isValid(x, y) and !reached[x][y] and wall[x][y] == '-') {
        Q.push(make_pair(x, y));
        reached[x][y] = true;
        waterHeight[x][y] = waterHeight[curr.first][curr.second] + 1;
      }
    }
  }
  cout << (possible ? "YES" : "NO") << endl;
}
