#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
const int MAXCHARN = 27;
bool dp[MAXN][MAXN];
int pre[MAXN][MAXN][2];
string P, S, ans;
int f[MAXN][MAXCHARN];
int Calc(string sub, const string &P) {
  for (int i = 0; i < sub.length(); i++)
    if (P.find(sub.substr(i)) == 0) return sub.length() - i;
  return 0;
}
int main() {
  int n, k, plen, slen, ansk;
  cin >> n >> k >> P >> S;
  plen = P.length();
  slen = S.length();
  for (int j = 0; j <= plen; j++)
    for (int x = 0; x < k; x++)
      f[j][x] = Calc(P.substr(0, j).append(1, 'a' + x), P);
  dp[0][1] = dp[0][0] = true;
  pre[0][1][0] = P[0] - 'a';
  pre[0][0][0] = P[0] == 'a' ? 1 : 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= plen; j++)
      if (dp[i][j]) {
        if (i >= plen - 1 && (S[i - plen + 1] == '1' && j < plen ||
                              S[i - plen + 1] == '0' && j == plen)) {
          dp[i][j] = false;
          continue;
        }
        if (i < n - 1)
          for (int x = 0; x < k; x++)
            dp[i + 1][f[j][x]] = true, pre[i + 1][f[j][x]][0] = x,
                   pre[i + 1][f[j][x]][1] = j;
      }
  for (ansk = 0; ansk <= plen; ansk++)
    if (dp[n - 1][ansk]) break;
  if (ansk > plen)
    cout << "No solution" << endl;
  else {
    ans = "";
    for (int i = n - 1; i >= 0; i--)
      ans.insert(0, 1, pre[i][ansk][0] + 'a'), ansk = pre[i][ansk][1];
    cout << ans << endl;
  }
  return 0;
}
