#include <bits/stdc++.h>
char a[200];
char b[200];
char ans[200];
int equ(int i) {
  for (int j = 0; a[j]; j++) {
    if (a[j] != ans[i]) return 0;
    i++;
  }
  return 1;
}
int judge() {
  for (int i = 0; b[i]; i++) {
    if (b[i] == '1') {
      if (equ(i) == 0) return 0;
    } else if (b[i] == '0') {
      if (equ(i) == 1) return 0;
    }
  }
  return 1;
}
int dfs(int step, int n, int k) {
  if (judge()) {
    if (step == n) {
      printf("%s\n", ans);
      return 1;
    }
  } else
    return 0;
  if (ans[step]) {
    return dfs(step + 1, n, k);
  }
  for (int i = 'a'; i < 'a' + k; i++) {
    ans[step] = i;
    if (dfs(step + 1, n, k)) return 1;
  }
  return 0;
}
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    memset(ans, 0, sizeof(ans));
    int fuck = 0;
    scanf("%s%s", a, b);
    for (int i = strlen(b); i < n; i++) {
      b[i] = '0';
    }
    for (int i = 0; i < n; i++) {
      if (b[i] == '1') {
        for (int j = 0; a[j]; j++) {
          if (ans[i + j] == 0 || ans[i + j] == a[j]) {
            ans[i + j] = a[j];
          } else {
            fuck = 1;
            break;
          }
        }
      }
      if (fuck) break;
    }
    if (fuck) {
      printf("No solution\n");
      continue;
    }
    if (judge() == 0) {
      fuck = 1;
    }
    if (fuck) {
      printf("No solution\n");
      continue;
    }
    if (dfs(0, n, m))
      continue;
    else
      fuck = 1;
    if (fuck) {
      printf("No solution\n");
      continue;
    }
  }
  return 0;
}
