#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
const int INF = 1e9 + 7;
vector<int> F;
string P;
void buildF() {
  F = vector<int>(P.size(), 0);
  for (int itP = 1, len = 0; itP < P.size(); itP++) {
    for (; len != -1 && P[itP] != P[len]; len = len ? F[len - 1] : -1)
      ;
    F[itP] = ++len;
  }
}
string S;
int n, k;
bool used[102][102];
bool memo[102][102];
bool dp(int pos, int lenPreff) {
  if (pos >= P.size() && (S[pos - P.size()] == '0') != (lenPreff != P.size()))
    return false;
  if (pos == n) return true;
  if (used[pos][lenPreff]) return memo[pos][lenPreff];
  used[pos][lenPreff] = true;
  bool &ans = memo[pos][lenPreff] = false;
  for (int c = 0; c < k; c++) {
    int newLen = lenPreff == P.size() ? F[lenPreff - 1] : lenPreff;
    for (; newLen != -1 && c + 'a' != P[newLen];
         newLen = newLen ? F[newLen - 1] : -1)
      ;
    if (newLen == -1 && P[0] == c + 'a') newLen = 0;
    ans |= dp(pos + 1, newLen + 1);
  }
  return ans;
}
string ans;
void rec(int pos, int lenPreff) {
  if (pos == n) return;
  for (int c = 0; c < k; c++) {
    int newLen = lenPreff == P.size() ? F[lenPreff - 1] : lenPreff;
    for (; newLen != -1 && c + 'a' != P[newLen];
         newLen = newLen ? F[newLen - 1] : -1)
      ;
    if (dp(pos, lenPreff) == dp(pos + 1, newLen + 1)) {
      ans += c + 'a';
      rec(pos + 1, newLen + 1);
      return;
    }
  }
}
int main() {
  cin >> n >> k;
  cin >> P >> S;
  buildF();
  if (!dp(0, 0)) {
    cout << "No solution";
    return 0;
  }
  rec(0, 0);
  cout << ans;
  return 0;
}
