#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  string name, code;
  cin >> n >> k >> name >> code;
  string res(code.size(), '*');
  for (int i = 0; i < code.size(); ++i) {
    if (code[i] == '1') {
      for (int j = 0; j < name.size(); ++j) {
        if (i + j < res.size()) {
          res[i + j] = name[j];
        } else {
          res.push_back(name[j]);
        }
      }
    }
  }
  for (int i = res.size(); i < n; ++i) {
    res.push_back('*');
  }
  for (int i = 0; i < res.size(); ++i) {
    if (i < code.size() && code[i] == '1') {
      if (res.substr(i, name.size()) != name) {
        cout << "No solution" << endl;
        return 0;
      }
    } else {
      if (res.substr(i, name.size()) == name) {
        cout << "No solution" << endl;
        return 0;
      }
      if (res[i] == '*') {
        int len = name.size() - 1;
        if (i < len) {
          len = i;
        }
        while (len > 1) {
          if (name.substr(0, len - 1) == res.substr(i - len + 1, len - 1)) {
            break;
          }
          --len;
        }
        res[i] = (((name[len > 0 ? len - 1 : 0] - 'a') + 1) % k) + 'a';
      }
    }
  }
  cout << res << endl;
}
