#include <bits/stdc++.h>
using namespace std;
inline long long int power(long long int a, long long int b) {
  long long int x = 1;
  while (b) {
    if (b & 1) x *= a;
    a *= a;
    b >>= 1;
  }
  return x;
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int N = 2e5 + 7;
long long int n, k;
vector<long long int> a, b;
string pat, pos;
long long int dp[105][105];
long long int m;
long long int nxt[105][26];
void kmp() {
  long long int lps[m];
  lps[0] = 0;
  for (long long int i = 1; i < m; i++) {
    long long int j = lps[i - 1];
    while (j and pat[i] != pat[j]) j = lps[j - 1];
    if (pat[j] == pat[i]) j++;
    lps[i] = j;
  }
  for (long long int i = 0; i < m + 1; i++) {
    for (char c = 'a'; c <= 'z'; c++) {
      long long int j = i;
      if (j == m) j = lps[m - 1];
      while (j and pat[j] != c) j = lps[j - 1];
      if (pat[j] == c) j++;
      nxt[i][c - 'a'] = j;
    }
  }
}
long long int go(long long int i, long long int cnt) {
  long long int& ans = dp[i][cnt];
  if (ans != -1) return ans;
  if (i == n) {
    if ((i - m) >= 0 and pos[i - m] != '1' and cnt == m) return ans = false;
    if ((i - m) >= 0 and pos[i - m] == '1' and cnt != m)
      return ans = false;
    else
      return ans = true;
  }
  if ((i - m) >= 0 and pos[i - m] != '1' and cnt == m) return ans = false;
  if ((i - m) >= 0 and pos[i - m] == '1' and cnt != m) return ans = false;
  for (char c = 'a'; c <= 'z'; c++) {
    long long int ncnt = nxt[cnt][c - 'a'];
    if (go(i + 1, ncnt)) return ans = 1;
  }
  return ans = 0;
}
string ans = "";
void get(long long int i, long long int cnt) {
  if (i == n) return;
  for (char ch = 'a'; ch <= 'z'; ch++) {
    long long int ncnt = nxt[cnt][ch - 'a'];
    if (dp[i + 1][ncnt]) {
      ans += ch;
      get(i + 1, ncnt);
      return;
    }
  }
  return;
}
void solve() {
  cin >> n >> k;
  cin >> pat;
  cin >> pos;
  m = pat.size();
  kmp();
  memset(dp, -1, sizeof(dp));
  long long int f = go(0, 0);
  if (f)
    get(0, 0), cout << ans;
  else
    cout << "No solution";
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(9) << fixed;
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
