#include <bits/stdc++.h>
using namespace std;
int tree[5000010];
void update(int node, int b, int e, int i) {
  if (b > i || e < i) return;
  if (b == i && e == i) {
    tree[node] ^= 1;
    return;
  }
  update(node * 2, b, (b + e) / 2, i),
      update(node * 2 + 1, (b + e) / 2 + 1, e, i);
  tree[node] = tree[node * 2] + tree[node * 2 + 1];
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int last = 0;
  char str[n + 1], c = 'a';
  for (int i = 0; i < n; i++) {
    update(1, 1, n, a[i]);
    update(1, 1, n, b[i]);
    if (!tree[1]) {
      for (int j = last; j <= i; j++) str[a[j]] = c;
      if (c != 'z') c++;
      k--;
      last = i + 1;
    }
  }
  if (k > 0) {
    cout << "NO";
    return 0;
  }
  cout << "YES\n";
  for (int i = 1; i <= n; i++) cout << str[i];
}
