#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e18;
const long long MAXN = 2e5 + 100;
long long N, K;
vector<long long> v1, v2;
long long cont = 0;
long long arr[MAXN];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> K;
  K--;
  string cad;
  long long temp = 0;
  for (long long i = 0; i < N; i++) {
    long long n;
    cin >> n;
    v1.push_back(n);
  }
  for (long long i = 0; i < N; i++) {
    long long n;
    cin >> n;
    v2.push_back(n);
  }
  bool band = false;
  for (long long i = 0; i < N; i++) {
    cad += 'a' + temp;
    if (temp == K) band = true;
    if (!arr[v1[i]]) {
      arr[v1[i]]++;
      cont++;
    } else {
      arr[v1[i]]--;
      cont--;
    }
    if (!arr[v2[i]]) {
      arr[v2[i]]++;
      cont++;
    } else {
      arr[v2[i]]--;
      cont--;
    }
    if (!cont) temp++;
    if (temp > K) temp = K;
  }
  if (!band) {
    cout << "NO" << '\n';
  } else {
    cout << "YES" << '\n';
    string temp;
    for (long long i = 0; i < N; i++) temp += " ";
    for (long long i = 0; i < N; i++) {
      temp[v2[i] - 1] = cad[i];
    }
    cout << temp << '\n';
  }
  return 0;
}
