#include <bits/stdc++.h>
using namespace std;
int n, k, ps[105], pdl;
char p[105], s[105], bin[105];
bool tak[105];
void pre() {
  ps[0] = 0;
  int poz = 0;
  for (int i = 1; p[i]; i++) {
    while (poz > 0 && p[poz] != p[i]) poz = ps[poz - 1];
    if (p[poz] == p[i]) poz++;
    ps[i] = poz;
  }
  p[pdl] = '#';
}
bool ustaw() {
  for (int i = 0; bin[i]; i++) {
    if (bin[i] == '1') {
      for (int j = 0; j < pdl; j++)
        if (s[i + j] == 0)
          s[i + j] = p[j];
        else if (s[i + j] != p[j])
          return 0;
      tak[i + pdl] = 1;
    }
  }
  return 1;
}
bool dzialaj(int nr, int dl) {
  if (dl == pdl && !tak[nr]) return 0;
  if (nr == n) return 1;
  if (s[nr] != 0) {
    while (dl > 0 && p[dl] != s[nr]) dl = ps[dl - 1];
    if (p[dl] == s[nr]) dl++;
    if (dzialaj(nr + 1, dl)) return 1;
  } else {
    int d = dl;
    for (int i = 'a' + k - 1; i >= 'a'; i--) {
      dl = d;
      s[nr] = i;
      while (dl > 0 && p[dl] != i) dl = ps[dl - 1];
      if (p[dl] == i) dl++;
      if (dzialaj(nr + 1, dl)) return 1;
    }
    s[nr] = 0;
  }
  return 0;
}
int main() {
  scanf("%d %d", &n, &k);
  scanf("%s", p);
  scanf("%s", bin);
  pdl = strlen(p);
  pre();
  if (!ustaw() || !dzialaj(0, 0))
    printf("No solution\n");
  else
    printf("%s\n", s);
  return 0;
}
