#include <bits/stdc++.h>
using namespace std;
int n, k;
string p;
char a[101], b[101];
int exist[1001];
int main() {
  cin >> n >> k;
  cin >> p;
  for (int i = 1; i <= n; i++) {
    a[i] = '?';
    b[i] = '0';
  }
  for (int i = 1; i <= n - p.length() + 1; i++) {
    char ch;
    cin >> ch;
    b[i] = ch;
    if (ch == '1') {
      int ii = 0;
      for (int j = i; j <= i + p.length() - 1; j++) {
        a[j] = p[ii];
        ii++;
      }
    }
  }
  memset(exist, 0, sizeof(exist));
  char fill = p[0];
  for (int i = 0; i < p.length(); i++) exist[p[i]] = 1;
  for (int i = 0; i < k; i++)
    if (exist['a' + i] == 0) fill = 'a' + i;
  for (int i = 1; i <= n; i++)
    if (a[i] == '?') a[i] = fill;
  for (int i = 1; i <= n - p.length() + 1; i++) {
    bool ok = true;
    int ii = 0;
    for (int j = i; j <= i + p.length() - 1; j++) {
      if (a[j] != p[ii]) {
        ok = false;
        break;
      }
      ii++;
    }
    if (b[i] == '0' && ok) {
      cout << "No solution";
      return 0;
    }
    if (b[i] == '1' && !ok) {
      cout << "No solution";
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) cout << a[i];
}
