#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
bool test(string res, string pattern, string name, int n) {
  bool ok = true;
  for (int i = 0; i + name.size() - 1 < n; ++i) {
    bool f = true;
    for (int j = 0; j < name.size(); ++j) f = f && (name[j] == res[i + j]);
    if (f && pattern[i] == '0' || !f && pattern[i] == '1') ok = false;
  }
  return ok;
}
string solve(string name, string pattern, string res, int k, int n, int pos) {
  string alpha = "";
  for (int i = 0; i < k; ++i) alpha = alpha + char('a' + i);
  while (pos < n) {
    if (res[pos] != '?') {
      ++pos;
      continue;
    }
    random_shuffle((alpha).begin(), (alpha).end());
    for (int i = 0; i < k; ++i) {
      res[pos] = alpha[i];
      if (test(res, pattern, name, n)) break;
    }
    if (!test(res, pattern, name, n)) {
      return "No solution";
    }
    ++pos;
  }
  return res;
}
int main() {
  double st = clock();
  int n, k;
  cin >> n >> k;
  string name;
  cin >> name;
  string pattern;
  cin >> pattern;
  string res(n, '?');
  bool ok = true;
  for (int i = 0; i + name.size() - 1 < n; ++i) {
    if (pattern[i] == '1') {
      if (i + name.size() - 1 < n) {
        for (int j = 0; j < name.size(); ++j)
          if (res[i + j] == '?')
            res[i + j] = name[j];
          else {
            if (res[i + j] != name[j]) ok = false;
          }
      } else
        ok = false;
    }
  }
  ok = ok && test(res, pattern, name, n);
  if (ok == false) {
    cout << "No solution";
    return 0;
  }
  int pos = 0;
  while (pattern[pos] == '0' && pos < min(res.size(), pattern.size())) {
    res[pos] = 'a' + ((name[0] - 'a' + 1) % k);
    ++pos;
  }
  while (fabs((clock() - st)) / CLOCKS_PER_SEC < 1.7) {
    string cur = solve(name, pattern, res, k, n, pos);
    if (cur != "No solution") {
      cout << cur;
      return 0;
    }
  }
  cout << "No solution";
  return 0;
}
