#include <bits/stdc++.h>
using namespace std;
int n, k, plen;
char p[200], ar[200];
char res[200];
int preone[200];
bool pos, found;
bool is_start(int ind) {
  if (plen + ind > n) return false;
  for (int l = 0; l < plen; l++)
    if (p[l] != res[l + ind]) return false;
  return true;
}
bool back(int ind) {
  if (ind < 0) {
    return true;
  }
  if (res[ind] != -1) {
    if (ar[ind] == '0' && is_start(ind)) return false;
    return back(ind - 1);
  }
  for (int i = 0; i < k; i++) {
    res[ind] = 'a' + i;
    if (!is_start(ind))
      if (back(ind - 1)) return true;
  }
  return false;
}
int main() {
  cin >> n >> k;
  cin >> p;
  cin >> ar;
  plen = strlen(p);
  for (int i = n - plen + 1; i < n; i++) {
    ar[i] = '0';
  }
  memset(res, -1, sizeof(res));
  pos = true;
  for (int i = 0; i < n && pos; i++) {
    if (ar[i] == '1') {
      for (int j = 0; j < plen && pos; j++) {
        if (res[i + j] != -1 && res[i + j] != p[j])
          pos = false;
        else
          res[i + j] = p[j];
      }
    }
  }
  if (pos && back(n)) {
    for (int i = 0; i < n; i++) cout << res[i];
  } else
    cout << "No solution";
  cout << endl;
}
