#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000009;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int MAXN = 100001;
const int MAXM = 0;
int a[2][MAXN];
int dp[2][MAXN];
char c;
int i, j, k, n;
class cmp {
 public:
  bool operator()(const pair<int, int> &a, const pair<int, int> &b) {
    if (dp[a.first][a.second] < dp[b.first][b.second]) return true;
    if (dp[a.first][a.second] > dp[b.first][b.second]) return false;
    return a < b;
  }
};
set<pair<int, int>, cmp> x;
void replace(pair<int, int> cur, int w) {
  x.erase(cur);
  dp[cur.first][cur.second] = w;
  x.insert(cur);
}
int main() {
  cin >> n >> k;
  for (i = 0; i < 2; i++)
    for (j = 0; j < n; j++) {
      cin >> c;
      if (c == '-') a[i][j] = true;
    }
  for (i = 0; i < 2; i++)
    for (j = 0; j < n; j++) dp[i][j] = INF;
  dp[0][0] = 0;
  x.insert(make_pair(0, 0));
  int water;
  while (x.size() > 0) {
    pair<int, int> cur = *x.begin();
    if (dp[cur.first][cur.second] == INF) break;
    water = dp[cur.first][cur.second];
    if (cur.second + k >= n) {
      cout << "YES" << endl;
      return 0;
    }
    if (water + 1 <= cur.second + 1 && a[cur.first][cur.second + 1] &&
        dp[cur.first][cur.second + 1] > water + 1)
      replace(make_pair(cur.first, cur.second + 1), water + 1);
    if (cur.second - 1 >= 0 && water + 1 <= cur.second - 1 &&
        a[cur.first][cur.second - 1] &&
        dp[cur.first][cur.second - 1] > water + 1)
      replace(make_pair(cur.first, cur.second - 1), water + 1);
    if (water + 1 <= cur.second + k && a[cur.first ^ 1][cur.second + k] &&
        dp[cur.first ^ 1][cur.second + k] > water + 1)
      replace(make_pair(cur.first ^ 1, cur.second + k), water + 1);
    x.erase(x.begin());
  }
  cout << "NO" << endl;
  return 0;
}
