#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> p(n), q(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  for (int i = 0; i < n; i++) {
    cin >> q[i];
    q[i]--;
  }
  set<int> p_set, q_set, block;
  vector<set<int>> blocks;
  for (int i = 0; i < n; i++) {
    block.insert(p[i]);
    block.insert(q[i]);
    p_set.insert(p[i]);
    q_set.insert(q[i]);
    if (q_set.count(p[i])) {
      p_set.erase(p[i]);
      q_set.erase(p[i]);
    }
    if (p_set.count(q[i])) {
      p_set.erase(q[i]);
      q_set.erase(q[i]);
    }
    if (p_set == q_set) {
      blocks.push_back(block);
      block.clear();
    }
  }
  string ans(n, 'a');
  int m = 0;
  char c = 'a';
  for (const auto& block : blocks) {
    for (auto i : block) ans[i] = c;
    if (c != 'z') c++;
    m++;
  }
  if (m >= k) {
    cout << "YES" << endl;
    cout << ans << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
