#include <bits/stdc++.h>
using namespace std;
const int inf = 1e8;
const long double pi = 3.141592653589793238;
int MOD = 998244353;
const int N = 1e6 + 22;
int n, k, p[N], q[N];
bool vis[N] = {0};
int seg[4 * N] = {0}, lazy[4 * N] = {0};
int fun(int a, int b) { return min(a, b); }
void rangeUpdate(int ind, int low, int high, int l, int r, int val) {
  if (lazy[ind] != 0) {
    seg[ind] += lazy[ind];
    if (low != high) {
      lazy[2 * ind + 1] += lazy[ind];
      lazy[2 * ind + 2] += lazy[ind];
    }
    lazy[ind] = 0;
  }
  if (r < low || l > high || low > high) return;
  if (low >= l && high <= r) {
    seg[ind] += val;
    if (low != high) {
      lazy[2 * ind + 1] += val;
      lazy[2 * ind + 2] += val;
    }
    return;
  }
  int mid = (low + high) / 2;
  rangeUpdate(2 * ind + 1, low, mid, l, r, val);
  rangeUpdate(2 * ind + 2, mid + 1, high, l, r, val);
  seg[ind] = fun(seg[2 * ind + 1], seg[2 * ind + 2]);
}
int querylazy(int ind, int low, int high, int l, int r) {
  if (lazy[ind] != 0) {
    seg[ind] += lazy[ind];
    if (low != high) {
      lazy[2 * ind + 1] += lazy[ind];
      lazy[2 * ind + 2] += lazy[ind];
    }
    lazy[ind] = 0;
  }
  if (r < low || l > high || low > high) return inf;
  if (l <= low && high <= r) return seg[ind];
  int mid = (low + high) / 2;
  return fun(querylazy(2 * ind + 1, low, mid, l, r),
             querylazy(2 * ind + 2, mid + 1, high, l, r));
}
void solve() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> q[i];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int mn = querylazy(0, 0, n, 0, n);
    if (mn == 0) {
      cnt++;
      vis[i] = 1;
    }
    rangeUpdate(0, 0, n, p[i], p[i], 1);
    rangeUpdate(0, 0, n, q[i], q[i], -1);
  }
  vector<char> ans(n + 1);
  if (cnt >= k) {
    cout << "YES" << '\n';
    char ch = 'a' - 1;
    for (int i = 0; i < n; i++) {
      if (vis[i] && ch < 'z') ch++;
      ans[p[i]] = ch;
    }
    for (int i = 1; i <= n; i++) cout << ans[i];
    cout << '\n';
    return;
  }
  cout << "NO" << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
