#include <bits/stdc++.h>
using namespace std;
int N, K;
string s, p, res;
int memo[200][200];
bool solve(int ind, int pref) {
  if (ind >= s.size()) {
    if (p[ind - s.size()] == '0' && pref == s.size()) return 0;
    if (p[ind - s.size()] == '1' && pref != s.size()) return 0;
  }
  if (ind == N) return 1;
  if (memo[ind][pref]) return 0;
  for (int i = 0; i < K; i++) {
    string t = s.substr(0, pref);
    t += (i + 'a');
    while (t.size() > s.size()) t.erase(t.begin());
    while (t != s.substr(0, t.size())) t.erase(t.begin());
    if (solve(ind + 1, t.size())) {
      res += (i + 'a');
      return 1;
    }
  }
  return memo[ind][pref] = 1, 0;
}
int main() {
  cin >> N >> K >> s >> p;
  if (solve(0, 0))
    reverse(res.begin(), res.end()), cout << res << endl;
  else
    cout << "No solution\n";
  return 0;
}
