#include <bits/stdc++.h>
using namespace std;
string mapa[2];
int d[2][100005];
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int w, n, k;
bool can = false, vis[2][100005];
int dfs(int x, int y, int l) {
  vis[x][y] = true;
  for (int i = 0; i < 4; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if (nx >= 0 && nx < 2) {
      if (ny >= n) {
        can = true;
        return 0;
      }
      if (ny > l && mapa[nx][ny] == '-' && !vis[nx][ny]) dfs(nx, ny, l + 1);
    }
  }
}
int main() {
  string aux;
  scanf("%d %d\n", &n, &k);
  getline(cin, mapa[0]);
  getline(cin, mapa[1]);
  dy[0] = dy[1] = k;
  dfs(0, 0, 0);
  if (can)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
