#include <bits/stdc++.h>
using namespace std;
int N, K;
int P;
char name[200];
char song[200];
bool complete(int i) {
  if (i == N) return true;
  if (song[i] != 0) return complete(i + 1);
  for (int l = 0; l < (K); l++) {
    song[i] = 'a' + l;
    bool flag = true;
    for (int j = max(0, i - P + 1); j <= min(i, N - P); j++) {
      bool temp = false;
      for (int k = 0; k < (P); k++) temp |= (song[j + k] != name[k]);
      flag = flag && temp;
    }
    if (flag && complete(i + 1)) return true;
  }
  song[i] = 0;
  return false;
}
int main() {
  scanf("%d%d", &N, &K);
  scanf("%s", name);
  P = strlen(name);
  char pattern[200];
  scanf("%s", pattern);
  bool flag = true;
  for (int i = 0; i <= N; i++) song[i] = 0;
  for (int i = 0; i + P <= N; i++) {
    pattern[i] -= '0';
    if (pattern[i]) {
      for (int j = 0; j < (P); j++) {
        if ((song[i + j] != 0) && (song[i + j] != name[j])) flag = false;
        song[i + j] = name[j];
      }
    }
  }
  for (int i = 0; i + P <= N; i++) {
    if (!pattern[i]) {
      bool temp = true;
      for (int j = 0; j < (P); j++) temp = temp && (name[j] == song[i + j]);
      if (temp) flag = false;
    }
  }
  flag = flag && complete(0);
  if (flag) {
    printf("%s\n", song);
  } else
    printf("No solution\n");
}
