#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
int dx[] = {0, 0, 1};
int dy[] = {1, -1, 0};
int n, k, vis[2][MAX];
string canyon[2];
bool BFS(int x = 0, int y = 0) {
  vis[x][y] = 1;
  queue<pair<pair<int, int>, int>> q;
  q.push({{x, y}, -1});
  while (!q.empty()) {
    x = q.front().first.first;
    y = q.front().first.second;
    int c = q.front().second;
    q.pop();
    if (y <= c) continue;
    for (int i = 0; i < 3; i++) {
      int tx = x ^ dx[i];
      int ty = y + dy[i];
      if (ty >= n) return true;
      if (ty >= 0 && !vis[tx][ty] && canyon[tx][ty] == '-') {
        vis[tx][ty] = 1;
        q.push({{tx, ty}, c + 1});
      }
    }
  }
  return false;
}
int main() {
  cin >> n >> k;
  cin >> canyon[0] >> canyon[1];
  dy[2] = k;
  puts(BFS() ? "YES" : "NO");
}
