#include <bits/stdc++.h>
const long double eps = 1e-9;
const long double pi = fabsl(atan2(0.0, -1.0));
const int INF = 0x7f7f7f7f;
const long long LINF = 1ll << 60;
const long double LDINF = 1e42;
using namespace std;
int n, k;
string s;
int a[110];
int res[110];
int p[110];
void Load() {
  cin >> n >> k;
  cin >> s;
  p[1] = 0;
  int i, k = 0;
  for (i = 2; i <= s.size(); i++) {
    while (k > 0 && s[k] != s[i - 1]) k = p[k];
    if (s[k] == s[i - 1]) k++;
    p[i] = k;
  }
  {
    int c = 0;
    while ((c = getchar()) != 10 && c != EOF)
      ;
  };
  for (int i = 0; i < n - s.size() + 1; i++) {
    a[i] = getchar() - '0';
  }
}
void Solve() {
  int k = 0, i, j, t;
  for (i = 0; i < n; i++) {
    if (a[i] == 1) {
      if (res[i] != 0) {
        for (j = 0; j < s.size(); j++) {
          if (res[i + j] != 0 && res[i + j] != s[j]) {
            cout << "No solution";
            return;
          } else {
            res[i + j] = s[j];
          }
        }
      } else {
        for (j = 0; j < s.size(); j++) {
          res[i + j] = s[j];
        }
      }
    }
    if (res[i] == 0) {
      int rr = 110, rch;
      for (j = 'a'; j <= 'a' + ::k - 1; j++) {
        t = k;
        while (t > 0 && s[t] != j) t = p[t];
        if (s[t] == j) t++;
        if (rr > t) {
          rr = t, rch = j;
        }
      }
      cerr << rr << " " << (char)rch;
      res[i] = rch;
      k = rr;
      if (k == s.size() && a[i - s.size() + 1] == 0) {
        cout << "No solution";
        return;
      }
    } else {
      t = k;
      while (t > 0 && s[t] != res[i]) t = p[t];
      if (s[t] == res[i]) t++;
      if (t == s.size() && a[i - s.size() + 1] == 0) {
        cout << "No solution";
        return;
      }
      k = t;
    }
  }
  for (i = 0; i < n; i++) {
    putchar(res[i]);
  }
}
int main() {
  Load();
  Solve();
  return 0;
}
