#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long mod6 = 1e6;
const long long N = 2e5 + 50;
const long long INF = 1e9 + 10;
long long abs(long long a, long long b) {
  return (a - b) < 0 ? -(a - b) : (a - b);
}
long long ans[N];
long long u[N];
long long sz[N];
long long find(long long x) {
  if (u[x] == x) return x;
  return u[x] = find(u[x]);
}
void Union(long long a, long long b) {
  a = find(a);
  b = find(b);
  if (a == b) return;
  u[a] = b;
  sz[b] += sz[a];
}
vector<pair<long long, pair<long long, long long> > > edges;
vector<pair<long long, long long> > queries;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) u[i] = i;
  for (long long i = 1; i <= n; i++) sz[i] = 1;
  vector<long long> a(n);
  vector<long long> b(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  unordered_set<long long> um2;
  long long j = 0;
  for (long long i = 0; i < n; i++) {
    Union(a[i], b[i]);
    if (um2.count(a[i])) continue;
    while (j < b.size() && !um2.count(a[i])) {
      Union(a[i], b[j]);
      um2.insert(b[j]);
      j++;
    }
  }
  set<long long> st;
  for (long long i = 1; i <= n; i++) st.insert(find(i));
  if (k > st.size()) {
    cout << "NO"
         << "\n";
    return 0;
  }
  map<long long, long long> make_pair;
  long long cnt = 0;
  for (long long i = 0; i < n; i++) {
    long long val = find(a[i]);
    if (make_pair.find(val) == make_pair.end()) {
      if (cnt < k)
        make_pair[val] = cnt++;
      else
        make_pair[val] = 25;
    }
  }
  cout << "YES"
       << "\n";
  for (long long i = 1; i <= n; i++) cout << (char)(make_pair[find(i)] + 'a');
  return 0;
}
