#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  char str[200];
  sscanf(gets(str), "%d%d", &n, &m);
  string o = gets(str);
  string r = gets(str);
  bool tag = count(o.begin(), o.end(), o[0]) != o.size();
  string s(n, tag ? o[0] : (o[0] - 'a' + 1) % m + 'a');
  for (size_t i = 0; i < r.size(); i++)
    if (r[i] == '1')
      for (size_t j = 0; j < o.size(); j++) s[i + j] = o[j];
  for (size_t i = 0; i < r.size(); i++) {
    string u = s.substr(i, o.size());
    if (r[i] == '1' && u != o || r[i] == '0' && u == o)
      return puts("No solution");
  }
  puts(s.c_str());
}
