#include <bits/stdc++.h>
using namespace std;
int n, k, tl, i, j;
char pattern[200], ans[200], s[200];
bool met[200];
bool match(int p) {
  for (int i = 1; i <= tl; ++i) {
    if (ans[p + i - 1] != s[i]) {
      return false;
    }
  }
  return true;
}
void performCheck() {
  for (int i = 1; i <= n - tl + 1; ++i) {
    if (pattern[i] == '0' && match(i)) {
      puts("No solution");
      exit(0);
    }
    if (pattern[i] == '1' && !match(i)) {
      puts("No solution");
      exit(0);
    }
  }
}
bool pacificCheck() {
  for (int i = 1; i <= n - tl + 1; ++i) {
    if (pattern[i] == '0' && match(i)) {
      return false;
    }
    if (pattern[i] == '1' && !match(i)) {
      return false;
    }
  }
  return true;
}
int main(int argc, const char *argv[]) {
  cin >> n >> k;
  scanf("%s", s + 1);
  tl = strlen(s + 1);
  scanf("%s", pattern + 1);
  for (i = 1; i <= n; ++i) {
    ans[i] = '?';
  }
  for (i = 1; i <= n - tl + 1; ++i) {
    if (pattern[i] == '1') {
      for (j = 1; j <= tl; ++j) {
        ans[i + j - 1] = s[j];
      }
    }
  }
  performCheck();
  for (i = 1; i <= n; ++i) {
    if (ans[i] == '?') {
      bool found = false;
      for (j = 0; j < k; ++j) {
        ans[i] = (char)('a' + j);
        if (pacificCheck()) {
          found = true;
          break;
        }
      }
      if (!found) {
        puts("No solution");
        return 0;
      }
    }
  }
  puts(ans + 1);
  return 0;
}
