#include <bits/stdc++.h>
using namespace std;
int FAIL[105][26];
int fail[105];
bool vis[105][105];
string p, pos, res;
int pn;
int N, K;
bool ok;
void KMPPreprocess() {
  int i = 0, j = -1;
  fail[0] = -1;
  while (i < pn) {
    while (j >= 0 && p[i] != p[j]) j = fail[j];
    i++;
    j++;
    fail[i] = j;
  }
}
void PreComputeFails() {
  for (int i = 0; i <= pn; i++)
    for (char c = 'a'; c <= 'z'; c++) {
      int k = i;
      while (k >= 0 && p[k] != c) k = fail[k];
      k++;
      FAIL[i][c - 'a'] = k;
    }
}
void dfs(int i, int j) {
  if (vis[i][j]) return;
  vis[i][j] = true;
  if (j == pn && pos[i - j] == '0') return;
  if (i - pn >= 0 && j != pn && pos[i - pn] == '1') return;
  if (i == N) {
    ok = true;
    return;
  }
  for (int c = 0; c < K; c++) {
    res[i] = c + 'a';
    dfs(i + 1, FAIL[j][c]);
    if (ok) return;
  }
}
int main(int argc, char const *argv[]) {
  cin >> N >> K;
  cin >> p;
  pn = p.length();
  p += "$";
  cin >> pos;
  KMPPreprocess();
  PreComputeFails();
  memset(vis, 0, sizeof vis);
  res.resize(N);
  ok = false;
  dfs(0, 0);
  if (!ok)
    cout << "No solution\n";
  else
    cout << res << "\n";
  return 0;
}
