#include <bits/stdc++.h>
using namespace std;
const int N = 204;
char s[N], t[N], p[N];
int n, k, nxt[N], f[N];
string solve() {
  int m = strlen(t + 1);
  for (int i = 2, j = 0; i <= m; i++) {
    while (j && t[j + 1] != t[i]) j = nxt[j];
    if (t[j + 1] == t[i]) ++j;
    nxt[i] = j;
  }
  t[m + 1] = t[1];
  for (int i = 1; i <= n - m + 1; i++) {
    if (p[i] == '1') {
      for (int j = 1; j <= m; j++) s[i + j - 1] = t[j];
    }
  }
  for (int i = 1, j = 0; i <= n; i++) {
    if (s[i] == 0) {
      char ch = (j == m ? t[nxt[m] + 1] : t[j + 1]);
      s[i] = (ch == 'a' ? 'b' : 'a');
    }
    while (j == m || j && s[i] != t[j + 1]) j = nxt[j];
    if (s[i] == t[j + 1]) ++j;
    f[i] = j;
  }
  for (int i = m; i <= n; i++)
    if ((f[i] == m) ^ (p[i - m + 1] == '1')) return "No solution";
  return s + 1;
}
int main() {
  scanf("%d %d %s %s", &n, &k, t + 1, p + 1);
  cout << solve() << endl;
}
