#include <bits/stdc++.h>
using namespace std;
struct w {
  bool ok;
  int pop_i, pop_j;
  char lit;
};
int Dl(string a, string b) {
  for (int i = min((int)a.size(), (int)b.size()); i >= 1; --i) {
    bool ok = true;
    int p = a.size() - i;
    int d = 0;
    for (int j = 0; j < i; ++j) {
      if (a[p] != b[d]) ok = false;
      ++p;
      ++d;
    }
    if (ok) return i;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, k, m;
  cin >> n >> k;
  string wzo, b;
  cin >> wzo >> b;
  char ost = (char)('a' + k - 1);
  m = wzo.size();
  vector<vector<w> > dp(n + 1, vector<w>(m + 1, {false, -1, -1, 'a' - 1}));
  if (!(m == 1 && b[0] == '0')) {
    dp[1][1].ok = true;
    dp[1][1].lit = wzo[0];
  }
  if (!(m == 1 && b[0] == '1')) {
    dp[1][0].ok = true;
    dp[1][0].lit = (wzo[0] == 'a' ? 'b' : 'a');
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j <= min(i, (int)wzo.size()); ++j) {
      if (!dp[i][j].ok) continue;
      for (char nast = 'a'; nast <= ost; ++nast) {
        string x = "";
        for (int l = 0; l < j; ++l) x += wzo[l];
        x += nast;
        int d = Dl(x, wzo);
        int pocz = (i + 1) - 1 - m + 1;
        if (d == m) {
          if (b[pocz] == '1') dp[i + 1][d] = {true, i, j, nast};
        } else {
          if (pocz < 0 || b[pocz] == '0') dp[i + 1][d] = {true, i, j, nast};
        }
      }
    }
  }
  string odp = "";
  if (b[b.size() - 1] == '1') {
    int i = n, j = m;
    if (dp[i][j].ok) {
      while (i != -1) {
        odp += dp[i][j].lit;
        int nowy_i = dp[i][j].pop_i;
        int nowy_j = dp[i][j].pop_j;
        i = nowy_i, j = nowy_j;
      }
      reverse(odp.begin(), odp.end());
      cout << odp;
    } else
      cout << "No solution";
  } else {
    int i = n, j;
    for (j = 0; j < m; ++j)
      if (dp[i][j].ok) break;
    if (j < m) {
      while (i != -1) {
        odp += dp[i][j].lit;
        int nowy_i = dp[i][j].pop_i;
        int nowy_j = dp[i][j].pop_j;
        i = nowy_i, j = nowy_j;
      }
      reverse(odp.begin(), odp.end());
      cout << odp;
    } else
      cout << "No solution";
  }
  return 0;
}
