#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
int main() {
  long long n, k, cn = 0;
  cin >> n >> k;
  vector<long long> v1, v2, v;
  for (long long i = 0; i < (long long)(n); ++i) {
    long long a;
    cin >> a;
    v1.push_back(a);
  }
  for (long long i = 0; i < (long long)(n); ++i) {
    long long a;
    cin >> a;
    v2.push_back(a);
  }
  set<long long> s1, s2;
  for (long long i = 0; i < n; i++) {
    if (s1.count(v2[i]))
      s1.erase(v2[i]);
    else
      s2.insert(v2[i]);
    if (s2.count(v1[i]))
      s2.erase(v1[i]);
    else
      s1.insert(v1[i]);
    if (s1.empty() && s2.empty()) {
      v.push_back(i);
      cn++;
    }
  }
  if (cn < k) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  string ss(n, ' ');
  long long j = 0, c = 0;
  for (long long i = 0; i < cn; i++) {
    while (j <= v[i]) {
      char ch = 'a' + min(c, (long long)25);
      ss[v1[j] - 1] = ch;
      j++;
    }
    c++;
  }
  cout << ss;
}
