#include <bits/stdc++.h>
struct node_type {
  char ch;
  int i, j;
} ff[110][110];
int n, K, len, ans_len;
int next[110];
bool tian[110], f[110][110];
char s[110], ans[110];
void get_next() {
  int i, j;
  for (i = 1, j = 0; i <= len;)
    if (j == 0 || s[i] == s[j])
      next[++i] = ++j;
    else
      j = next[j];
}
int val(const char &ch) { return ch - 'a' + 1; }
int get_jj(int j, const int &k) {
  j++;
  while (j && s[j] != k + 'a' - 1) j = next[j];
  return j;
}
int main() {
  int i, j, k, jj;
  char ch;
  scanf("%d%d", &n, &K);
  scanf("%s", s + 1);
  len = strlen(s + 1);
  for (i = 1; i <= len; i++) {
    k = val(s[i]);
    if (k < 1 || k > K) {
      printf("No solution\n");
      return 0;
    }
  }
  get_next();
  getchar();
  for (i = 1; i <= n - len + 1; i++) {
    ch = getchar();
    if (ch == '1') tian[i + len - 1] = true;
  }
  f[0][0] = true;
  for (i = 0; i < n; i++)
    for (j = 0; j <= len; j++)
      if (f[i][j])
        for (k = 1; k <= K; k++) {
          jj = get_jj(j, k);
          if (tian[i + 1] && jj != len) continue;
          if (!tian[i + 1] && jj == len) continue;
          f[i + 1][jj] = true;
          ff[i + 1][jj].ch = k + 'a' - 1;
          ff[i + 1][jj].i = i;
          ff[i + 1][jj].j = j;
        }
  for (k = 0; k <= len; k++)
    if (f[n][k]) {
      i = n;
      j = k;
      while (i) {
        ans_len++;
        ans[n - ans_len + 1] = ff[i][j].ch;
        jj = j;
        j = ff[i][j].j;
        i = ff[i][jj].i;
      }
      printf("%s\n", ans + 1);
      return 0;
    }
  printf("No solution\n");
}
