#include <bits/stdc++.h>
using namespace std;
string pattern, str;
int lps[210], m, ss[210], n, k;
void make_lps(string pattern) {
  int n = pattern.size();
  lps[0] = lps[1] = 0;
  for (int i = 2; i <= n; i++) {
    int p = lps[i - 1];
    while (true) {
      if (pattern[i - 1] == pattern[p]) {
        lps[i] = p + 1;
        break;
      }
      if (p == 0)
        break;
      else
        p = lps[p];
    }
  }
}
int getPos(int c, char ch) {
  int a;
  for (a = c; pattern[a] != ch; a = lps[a])
    if (a == 0) {
      a = -1;
      break;
    }
  return a + 1;
}
int dp[210][210];
int rec(int p, int c) {
  if (p == n) return 1;
  int &temp = dp[p][c];
  if (temp != -1) return temp;
  temp = 0;
  for (int i = 0; i <= k - 1; i++) {
    char ch = 'a' + i;
    int nc = getPos(c, ch);
    if (ss[p] == 0 && nc == m)
      continue;
    else if (ss[p] == 1 && nc != m)
      continue;
    temp = max(temp, rec(p + 1, nc));
  }
  return temp;
}
void prin(int p, int c) {
  if (p == n) return;
  int &temp = dp[p][c];
  temp = 0;
  for (int i = 0; i <= k - 1; i++) {
    char ch = 'a' + i;
    int nc = getPos(c, ch);
    if (ss[p] == 0 && nc == m)
      continue;
    else if (ss[p] == 1 && nc != m)
      continue;
    if (rec(p + 1, nc)) {
      cout << ch;
      prin(p + 1, nc);
      return;
    }
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  cin >> pattern >> str;
  m = pattern.size();
  for (int i = 0; i <= str.size() - 1; i++)
    if (str[i] == '1') ss[i + m - 1] = 1;
  make_lps(pattern);
  memset(dp, -1, sizeof(dp));
  if (rec(0, 0))
    prin(0, 0);
  else
    cout << "No solution" << endl;
  return 0;
}
