#include <bits/stdc++.h>
using namespace std;
int kmp(string s1, string s2) {
  string s = s1 + '&' + s2;
  vector<int> p;
  p.resize(s.size());
  for (int i = (1); i < (p.size()); ++i) {
    int k = p[i - 1];
    while ((k) && (s[i] != s[k])) k = p[k - 1];
    if (s[i] == s[k]) k++;
    p[i] = k;
  }
  return p[p.size() - 1];
}
int prep[110][30];
string p;
string need;
int n, k;
int dp[110][110];
int way[110][110];
int r(int pos, int pref) {
  if (pos == n) {
    if ((pos >= p.size()) && (need[pos - p.size()] == '1')) {
      return (pref == p.size());
    } else {
      return (pref != p.size());
    }
  }
  if (dp[pos][pref] != -1) return dp[pos][pref];
  int res = 0;
  if ((pos >= p.size()) && (need[pos - p.size()] == '1') && (pref != p.size()))
    return dp[pos][pref] = res;
  if ((pos >= p.size()) && (need[pos - p.size()] == '0') && (pref == p.size()))
    return dp[pos][pref] = res;
  for (int i = (0); i < (k); ++i) {
    res = max(res, r(pos + 1, prep[pref][i]));
    if (res) {
      way[pos][pref] = i;
      break;
    }
  }
  return dp[pos][pref] = res;
}
int main() {
  cin >> n >> k;
  cin >> p;
  cin >> need;
  for (int i = (0); i < (p.size() + 1); ++i) {
    string s1 = "";
    for (int j = (0); j < (i); ++j) s1 += p[j];
    s1 += ' ';
    for (int j = (0); j < (k); ++j) {
      s1[s1.size() - 1] = 'a' + j;
      prep[i][j] = kmp(p, s1);
    }
  }
  memset(dp, -1, sizeof(dp));
  int res = r(0, 0);
  if (res) {
    int pos = 0, pref = 0;
    while (pos < n) {
      printf("%c", way[pos][pref] + 'a');
      pref = prep[pref][way[pos][pref]];
      pos++;
    }
    printf("\n");
  } else
    cout << "No solution" << endl;
  return 0;
}
