#include <bits/stdc++.h>
using namespace std;
string s;
string f;
string bm;
int k;
bool canSettle(string t, int x) {
  for (int i = 0; i < t.size(); ++i)
    if (s[x + i] != ' ' && s[x + i] != t[i]) return 0;
  return 1;
}
bool rec(int x) {
  if (x == s.size()) {
    if (bm[x - f.size()] != '1' && canSettle(f, x - f.size())) return false;
    printf("%s\n", s.c_str());
    return true;
  }
  if (x >= f.size() && bm[x - f.size()] != '1' && canSettle(f, x - f.size()))
    return false;
  if (s[x] != ' ') return rec(x + 1);
  for (int i = 0; i < k; ++i) {
    s[x] = 'a' + i;
    if (rec(x + 1)) return true;
  }
  s[x] = ' ';
  return false;
}
int main() {
  int n;
  string ss, t;
  cin >> n >> k >> ss >> t;
  bm = t;
  for (int i = 0; i < n; ++i) s = s + " ";
  for (int i = 0; i <= n - ss.size(); ++i)
    if (t[i] == '1') {
      if (!canSettle(ss, i)) {
        printf("No solution\n");
        return 0;
      }
      for (int j = 0; j < ss.size(); ++j) s[i + j] = ss[j];
    }
  f = ss;
  if (!rec(0)) printf("No solution\n");
  return 0;
}
