#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const double eps = 1e-8;
const double pi = acos(-1.0);
int n, m;
char a[110], b[110], c[110];
int d[26];
int main() {
  srand(time(NULL));
  scanf("%d%d%s%s", &n, &m, a, b);
  int la = strlen(a), lb = strlen(b);
  int flag = 1;
  for (int i = 0; i < lb; i++)
    if (b[i] == '1') {
      for (int j = 0; j < la; j++)
        if (c[i + j] == 0 || c[i + j] == a[j]) {
          c[i + j] = a[j];
        } else
          flag = 0;
      if (flag == 0) break;
    }
  if (flag) {
    for (int i = 0; i < m; i++) d[i] = i;
    for (int i = 0; i < lb; i++)
      if (b[i] == '0') {
        int done = 0;
        for (int j = 0; j < la; j++)
          if (c[i + j] == 0) {
            random_shuffle(d, d + m);
            for (int k = 0; k < m; k++) {
              if (d[k] + 'a' != a[j]) {
                c[i + j] = d[k] + 'a', done = 1;
                break;
              }
            }
          } else if (c[i + j] != a[j]) {
            done = 1;
            break;
          }
        if (!done) {
          flag = 0;
          break;
        }
      }
  }
  for (int i = 0; i < n; i++)
    if (c[i] == 0) c[i] = 'a';
  if (flag)
    puts(c);
  else
    puts("No solution");
  return 0;
}
