#include <bits/stdc++.h>
using namespace std;
long long n, k, num, cont, p[200005], q[200005], freq[200005];
bool pos[200005];
char c;
string ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) ans.push_back('a');
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> q[i];
  for (int i = 0; i < n; i++) {
    freq[p[i]]++;
    if (freq[p[i]] == 0) cont++;
    freq[q[i]]--;
    if (freq[q[i]] == 0) cont++;
    if (cont == (i + 1)) {
      pos[i] = true;
      num++;
    }
  }
  if (num < k)
    cout << "NO\n";
  else {
    cout << "YES\n";
    c = 'a';
    k--;
    for (int i = 0; i < n; i++) {
      ans[p[i] - 1] = c;
      if (pos[i] == true && k > 0) {
        c++;
        k--;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
