#include <bits/stdc++.h>
using namespace std;
int f[200][200];
pair<int, int> pre[200][200];
string name;
char ok[200], s[200];
int n, m, k, dfa[200], r[200];
void print(int n, int x) {
  if (!n) return;
  print(n - 1, pre[n][x].first);
  cout << char(pre[n][x].second + 96);
}
int main() {
  cin >> n >> k;
  cin >> name;
  m = name.size();
  for (int i = 1; i <= n - m + 1; i++) cin >> ok[i];
  for (int i = 1; i <= m; i++) s[i] = name[i - 1];
  for (int i = 1; i <= m; i++)
    for (r[i] = 0; r[i] < m && i + r[i] <= m;)
      if (s[r[i] + 1] == s[i + r[i]])
        r[i]++;
      else
        break;
  memset(f, 0, sizeof(f));
  f[0][0] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= min(i, m - 1); j++)
      if (f[i][j])
        for (int next = 1; next <= k; next++) {
          int flag;
          for (int o = 1; o <= j + 1; o++) {
            dfa[o] = min(r[o], j + 1 - o);
            if (dfa[o] == j + 1 - o)
              if (next == s[dfa[o] + 1] - 96) dfa[o]++;
          }
          if (j == m - 1 && dfa[1] == m && ok[i - j + 1] == '0') continue;
          flag = 1;
          for (int o = 1; o <= j + 1; o++)
            if (ok[i + 1 - (j + 1 - o)] == '1' && dfa[o] < j + 1 - o + 1)
              flag = 0;
          if (!flag) continue;
          flag = 0;
          for (int o = 1; o <= j + 1; o++)
            if (dfa[o] != m && dfa[o] == j + 1 - o + 1) {
              flag = dfa[o];
              break;
            }
          if (!f[i + 1][flag]) {
            f[i + 1][flag] = 1;
            pre[i + 1][flag] = make_pair(j, next);
          }
        }
  int ans = -1;
  for (int i = 0; i < m; i++)
    if (f[n][i]) {
      ans = i;
      break;
    }
  if (ans == -1)
    cout << "No solution" << endl;
  else
    print(n, ans);
  cout << endl;
  return 0;
}
