#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
T power(T N, T P) {
  return (P == 0) ? 1 : N * power(N, P - 1);
}
long long toInt64(string s) {
  long long r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
double LOG(long long N, long long B) { return (log10l(N)) / (log10l(B)); }
string itoa(long long a) {
  if (a == 0) return "0";
  string ret;
  for (long long i = a; i > 0; i = i / 10) ret.push_back((i % 10) + 48);
  reverse(ret.begin(), ret.end());
  return ret;
}
vector<string> token(string a, string b) {
  const char *q = a.c_str();
  while (count(b.begin(), b.end(), *q)) q++;
  vector<string> oot;
  while (*q) {
    const char *e = q;
    while (*e && !count(b.begin(), b.end(), *e)) e++;
    oot.push_back(string(q, e));
    q = e;
    while (count(b.begin(), b.end(), *q)) q++;
  }
  return oot;
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
int check(int N, int pos) { return (N & (1 << pos)); }
int toggle(int N, int pos) {
  if (check(N, pos)) return N = Reset(N, pos);
  return N = Set(N, pos);
}
void PBIT(int N) {
  printf("(");
  for (int i = 10; i >= 0; i--) {
    bool x = check(N, i);
    cout << x;
  }
  puts(")");
}
string s[4];
int d[3][200002];
int bfs(int n, int k) {
  memset(d, 63, sizeof(d));
  ;
  queue<pair<int, int> > q;
  q.push(pair<int, int>(0, 0));
  d[0][0] = 0;
  while (!q.empty()) {
    pair<int, int> top = q.front();
    q.pop();
    int u = top.second, w = top.first;
    if (u + 1 >= n)
      return 1;
    else if (s[w][u + 1] == '-' and d[w][u] + 1 < d[w][u + 1] and
             d[w][u] + 1 <= u + 1) {
      d[w][u + 1] = d[w][u] + 1;
      q.push(pair<int, int>(w, u + 1));
    }
    if (u - 1 >= 0) {
      if (s[w][u - 1] == '-' and d[w][u] + 1 < d[w][u - 1] and
          d[w][u] + 1 <= u - 1) {
        d[w][u - 1] = d[w][u] + 1;
        q.push(pair<int, int>(w, u - 1));
      }
    }
    if (u + k >= n)
      return 1;
    else if (s[!w][u + k] == '-' and d[w][u] + 1 < d[!w][u + k] and
             d[w][u] + 1 <= u + k) {
      d[!w][u + k] = d[w][u] + 1;
      q.push(pair<int, int>(!w, u + k));
    }
  }
  return 0;
}
int main() {
  int n, k;
  cin >> n >> k;
  cin >> s[0] >> s[1];
  int ret = bfs(n, k);
  printf("%s\n", (ret == 0) ? "NO" : "YES");
  return 0;
}
