#include <bits/stdc++.h>
using namespace std;
long long n, k;
string s;
char arr[105];
long long cache[106][106][2];
string seq;
long long dp(long long pos, long long cont, long long st) {
  if (cont == s.length() && st) return 0;
  if (pos == n) return 1;
  if (cache[pos][cont][st] != -1) return cache[pos][cont][st];
  if (seq[pos] == '1') {
    if (st && arr[pos] == s[cont])
      return cache[pos][cont][st] = dp(pos + 1, cont + 1, 1);
    else
      return cache[pos][cont][st] = dp(pos + 1, 0, 0);
  } else {
    if (arr[pos] != '$') {
      if (arr[pos] == s[cont])
        return cache[pos][cont][st] = dp(pos + 1, cont + 1, 1);
      else if (arr[pos] == s[0])
        return cache[pos][cont][st] = dp(pos + 1, 1, 1);
      else
        return cache[pos][cont][st] = dp(pos + 1, 0, 0);
    } else {
      long long ans = 0;
      for (long long j = 0; j < k; j++) {
        if (st == 1) {
          if (j == s[cont] - 97)
            ans |= dp(pos + 1, cont + 1, 1);
          else {
            if (j == s[0] - 97)
              ans |= dp(pos + 1, 1, 1);
            else
              ans |= dp(pos + 1, 0, 0);
          }
        } else {
          if (j == s[0] - 97)
            ans |= dp(pos + 1, 1, 1);
          else
            ans |= dp(pos + 1, 0, 0);
        }
      }
      return cache[pos][cont][st] = ans;
    }
  }
}
void path(long long pos, long long cont, long long st) {
  if (pos == n) {
    for (long long j = 0; j < n; j++) cout << arr[j];
    exit(0);
  }
  if (seq[pos] == '1') {
    if (st && arr[pos] == s[cont])
      path(pos + 1, cont + 1, 1);
    else
      path(pos + 1, 0, 0);
  } else {
    if (arr[pos] != '$') {
      if (arr[pos] == s[cont])
        path(pos + 1, cont + 1, 1);
      else if (arr[pos] == s[0])
        path(pos + 1, 1, 1);
      else
        path(pos + 1, 0, 0);
    } else {
      for (long long j = 0; j < k; j++) {
        if (st == 1) {
          if (j == s[cont] - 97) {
            if (dp(pos + 1, cont + 1, 1)) {
              arr[pos] = (char)(j + 97);
              path(pos + 1, cont + 1, 1);
            }
          } else {
            if (j == s[0] - 97) {
              if (dp(pos + 1, 1, 1)) {
                arr[pos] = (char)(j + 97);
                path(pos + 1, 1, 1);
              }
            } else {
              if (dp(pos + 1, 0, 0)) {
                arr[pos] = (char)(j + 97);
                path(pos + 1, 0, 0);
              }
            }
          }
        } else {
          if (j == s[0] - 97) {
            if (dp(pos + 1, 1, 1)) {
              arr[pos] = (char)(j + 97);
              path(pos + 1, 1, 1);
            }
          } else {
            if (dp(pos + 1, 0, 0)) {
              arr[pos] = (char)(j + 97);
              path(pos + 1, 0, 0);
            }
          }
        }
      }
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k >> s;
  cin >> seq;
  for (long long i = 0; i < 105; i++) arr[i] = '$';
  while (seq.length() != n) seq += '0';
  for (long long i = 0; i < seq.length(); i++) {
    if (seq[i] == '1') {
      for (long long j = i; j < i + s.length(); j++) {
        if (arr[j] != '$' && arr[j] != s[j - i])
          return cout << "No solution", 0;
        arr[j] = s[j - i];
      }
    }
  }
  memset(cache, -1, sizeof(cache));
  if (!dp(0, 0, 0)) return cout << "No solution", 0;
  path(0, 0, 0);
}
