#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double eps = (1e-4);
int dcmp(long double x, long double y) {
  if (abs(x - y) < eps) return 0;
  if (x > y) return 1;
  return -1;
}
const int MAX_N = 200003;
vector<int> adj[MAX_N];
int n, totalNodes;
int comp[MAX_N], dfsTime[MAX_N], lowLink[MAX_N], curTime, compNum;
stack<int> st;
void dfs(int u) {
  ++curTime;
  dfsTime[u] = lowLink[u] = curTime;
  st.push(u);
  for (auto v : adj[u]) {
    if (comp[v] != -1) continue;
    if (dfsTime[v] == -1) {
      dfs(v);
      lowLink[u] = min(lowLink[u], lowLink[v]);
    } else
      lowLink[u] = min(lowLink[u], dfsTime[v]);
  }
  if (lowLink[u] == dfsTime[u]) {
    while (!st.empty()) {
      int cur = st.top();
      st.pop();
      comp[cur] = compNum;
      if (cur == u) break;
    }
    ++compNum;
  }
}
void SCC() {
  curTime = -1;
  compNum = 0;
  memset(comp, -1, totalNodes * sizeof(comp[0]));
  memset(dfsTime, -1, totalNodes * sizeof(dfsTime[0]));
  for (int i = 0; i < totalNodes; ++i) {
    if (dfsTime[i] == -1) dfs(i);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int k;
  cin >> n >> k;
  totalNodes = n;
  vector<int> v[2];
  for (int i = 0; i < 2; ++i) v[i].resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[0][i];
    --v[0][i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> v[1][i];
    --v[1][i];
  }
  for (int j = 0; j < 2; ++j) {
    for (int i = 1; i < n; ++i) {
      int u = v[j][i], to = v[j][i - 1];
      adj[u].push_back(to);
    }
  }
  SCC();
  if (compNum < k)
    cout << "NO\n";
  else {
    cout << "YES\n";
    for (int i = 0; i < n; ++i) {
      if (comp[i] < 26)
        cout << (char)('a' + comp[i]);
      else
        cout << 'z';
    }
  }
  return 0;
}
