#include <bits/stdc++.h>
using namespace std;
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.second == b.second)
    return a.first < b.first;
  else
    return a.second > b.second;
}
int power(int a, int b) {
  int x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > 1000000007) x %= 1000000007;
    }
    y = (y * y);
    if (y > 1000000007) y %= 1000000007;
    b /= 2;
  }
  return x;
}
char s[2][100005];
bool vis[2][100005];
struct node {
  int x, y, level;
};
int n, k;
bool bfs() {
  queue<node> q;
  node a;
  a.x = 0;
  a.y = 0;
  a.level = 0;
  q.push(a);
  node b;
  while (!q.empty()) {
    a = q.front();
    q.pop();
    if (a.y + 1 >= n || a.y + k >= n) return true;
    if (s[a.x][a.y + 1] == '-' && vis[a.x][a.y + 1] == false) {
      b.y = a.y + 1;
      b.x = a.x;
      vis[b.x][b.y] = true;
      b.level = 1 + a.level;
      q.push(b);
    }
    if (s[a.x][a.y - 1] == '-' && a.y >= 0 && vis[a.x][a.y - 1] == false) {
      b.y = a.y - 1;
      b.x = a.x;
      b.level = 1 + a.level;
      if (b.y >= b.level) {
        q.push(b);
        vis[b.x][b.y] = true;
      }
    }
    if (s[!a.x][a.y + k] == '-' && vis[!a.x][a.y + k] == false) {
      b.x = !a.x;
      b.y = a.y + k;
      b.level = a.level + 1;
      q.push(b);
      vis[b.x][b.y] = true;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  cin >> s[0] >> s[1];
  if (bfs())
    cout << "YES\n";
  else
    cout << "NO\n";
}
