#include <bits/stdc++.h>
using namespace std;
int N, K;
string P;
string line;
string pattern;
bool state[200][200];
char last[200][200];
int lastprelen[200][200];
int prefixChange[200][200];
void calPrefixChange() {
  for (int i = 0; i <= P.length(); ++i) {
    string now = P.substr(0, i);
    for (char c = 'a'; c <= 'a' + K - 1; ++c) {
      string news = now + string(1, c);
      for (int k = news.length(); k >= 0; --k)
        if (news.substr(news.length() - k, k) == P.substr(0, k)) {
          prefixChange[i][c] = k;
          break;
        }
    }
  }
}
void york() {
  for (int i = 0; i < pattern.length(); ++i)
    if (pattern[i] == '1')
      for (int k = 0; k < P.length(); ++k)
        if (line[i + k] != P[k]) {
          cout << "No solution" << endl;
          return;
        }
  calPrefixChange();
  memset(state, false, sizeof(state));
  state[0][0] = true;
  for (int pos = 0; pos < N; ++pos)
    for (int prelen = 0; prelen <= P.length(); ++prelen) {
      if (state[pos][prelen] == false) continue;
      if (line[pos] == '.') {
        for (char c = 'a'; c <= 'a' + K - 1; ++c) {
          int newprelen = prefixChange[prelen][c];
          if (newprelen < P.length()) {
            state[pos + 1][newprelen] = true;
            last[pos + 1][newprelen] = c;
            lastprelen[pos + 1][newprelen] = prelen;
          }
        }
      } else {
        int newprelen = prefixChange[prelen][line[pos]];
        if (pos + 1 >= P.length() && newprelen == P.length() &&
            pattern[pos + 1 - P.length()] == '0')
          continue;
        state[pos + 1][newprelen] = true;
        last[pos + 1][newprelen] = line[pos];
        lastprelen[pos + 1][newprelen] = prelen;
      }
    }
  for (int i = 0; i <= P.length(); ++i)
    if (state[N][i]) {
      string ans(N, '.');
      int nowprelen = i;
      for (int pos = N; pos >= 1; --pos) {
        ans[pos - 1] = last[pos][nowprelen];
        nowprelen = lastprelen[pos][nowprelen];
      }
      cout << ans << endl;
      return;
    }
  cout << "No solution" << endl;
}
void init() {
  cin >> N >> K;
  cin >> P;
  line.resize(N, '.');
  cin >> pattern;
  for (int i = 0; i < pattern.length(); ++i)
    if (pattern[i] == '1')
      for (int k = 0; k < P.length(); ++k) line[i + k] = P[k];
}
int main() {
  init();
  york();
  return 0;
}
