#include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
int a[N], b[N];
map<int, int> m;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<char> s(n, '\0');
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  int c = 0;
  for (int i = 1; i <= n; i++) {
    if (m.find(a[i]) == m.end()) {
      m[a[i]]++;
    } else {
      m[a[i]]--;
      m.erase(a[i]);
    }
    if (m.find(b[i]) == m.end()) {
      m[b[i]]++;
    } else {
      m[b[i]]--;
      m.erase(b[i]);
    }
    if (c > 25)
      s[a[i] - 1] = 'z';
    else
      s[a[i] - 1] = char('a' + c);
    if (m.size() == 0 && c <= k - 1) c++;
  }
  if (c <= k - 1) return cout << "NO", 0;
  cout << "YES" << '\n';
  for (auto i : s) cout << i;
  return 0;
}
