#include <bits/stdc++.h>
using namespace ::std;
const long double PI = acos(-1);
const long long MOD = 1000000000 + 7;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long add(long long a, long long b, long long m = MOD) {
  return (a % m + b % m + 2 * m) % m;
}
long long mul(long long a, long long b, long long m = MOD) {
  return ((a % m + m) * (b % m + m)) % m;
}
long long pow_mod(long long a, long long b, long long m = MOD) {
  long long res = 1LL;
  a = a % m;
  while (b) {
    if (b & 1) res = mul(res, a, m);
    b >>= 1;
    a = mul(a, a, m);
  }
  return res;
}
long long fastexp(long long a, long long b) {
  long long res = 1LL;
  while (b) {
    if (b & 1) res = res * a;
    b >>= 1;
    a *= a;
  }
  return res;
}
int gcdExtendido(int a, int b, int *x, int *y) {
  if (a == 0) {
    *x = 0;
    *y = 1;
    return b;
  }
  int x1, y1;
  int gcd = gcdExtendido(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
int modInverso(int a, int m) {
  int x, y;
  int g = gcdExtendido(a, m, &x, &y);
  if (g != 1)
    return -1;
  else
    return (x % m + m) % m;
}
const int N = 100000 + 5;
int n, k;
int D[3][N];
char table[3][N];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
bool validPos(int i, int j) { return i >= 0 and i < 2 and j >= 0 and j < n; }
bool BFS(int sx, int sy) {
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j <= n; j++) {
      D[i][j] = INT_MAX;
    }
  }
  D[sx][sy] = 0;
  queue<int> Q;
  Q.push(sx);
  Q.push(sy);
  while (!Q.empty()) {
    int ux = Q.front();
    Q.pop();
    int uy = Q.front();
    Q.pop();
    int T = D[ux][uy];
    for (int l = 0; l < 4; l++) {
      int vx = ux + dx[l];
      int vy = uy + dy[l];
      if (validPos(vx, vy) and table[vx][vy] != 'X' and vy >= T + 1) {
        if (D[vx][vy] > D[ux][uy] + 1) {
          D[vx][vy] = D[ux][uy] + 1;
          Q.push(vx);
          Q.push(vy);
        }
      } else if (vy >= n) {
        return true;
      }
    }
  }
  return false;
}
int main() {
  scanf("%d %d", &(n), &(k));
  dy[2] = dy[3] = k;
  for (int i = 0; i < 2; i++) {
    scanf("%s", table[i]);
  }
  puts(BFS(0, 0) ? "YES" : "NO");
  return 0;
}
