#include <bits/stdc++.h>
using namespace std;
int n, k;
string a, occur;
char v[400], g[400];
int check() {
  for (int i = 0; i < n - a.size() + 1; i++) {
    int cur = 1;
    for (int j = i; j <= i + a.size() - 1; j++)
      if (g[j] != a[j - i]) cur = 0;
    if (cur != (occur[i] - 48)) return 0;
  }
  return 1;
}
int main() {
  srand(time(0));
  cin >> n >> k;
  cin >> a >> occur;
  int flag = 1;
  for (int i = 0; i < n; i++) v[i] = ' ';
  for (int i = 0; i < n - a.size() + 1; i++)
    if (occur[i] == '1') {
      for (int j = i; j <= i + a.size() - 1; j++) {
        char x = a[j - i];
        if (v[j] != ' ' && v[j] != x) {
          flag = 0;
          break;
        }
        v[j] = x;
      }
      if (!flag) break;
    }
  if (!flag) {
    cout << "No solution" << endl;
    return 0;
  }
  for (int lp = 0; lp <= 500000; lp++) {
    for (int i = 0; i < n; i++)
      g[i] = ((v[i] == ' ') ? (lp < k ? char(97 + lp) : char(rand() % k + 97))
                            : v[i]);
    if (check()) {
      for (int i = 0; i < n; i++) cout << g[i];
      cout << endl;
      return 0;
    }
  }
  cout << "No solution" << endl;
  return 0;
}
