#include <bits/stdc++.h>
#pragma GCC optimization("O3")
using namespace std;
template <typename T>
inline void Cin(T& first) {
  char c;
  T sign = 1;
  first = 0;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') sign = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) first = first * 10 + c - '0';
  first *= sign;
}
template <typename T>
inline void Out(T first) {
  if (first > 9) Out(first / 10);
  putchar(first % 10 + '0');
}
template <typename T>
inline void Cout(T first, char c) {
  if (first < 0) putchar('-');
  first = abs(first);
  Out(first);
  putchar(c);
}
template <typename T, typename... Args>
inline void Cin(T& a, Args&... args) {
  Cin(a);
  Cin(args...);
}
template <typename T, typename... Args>
inline void Cout(T a, char c, Args... args) {
  Cout(a, c);
  Cout(args...);
}
const int N = 203;
int n, m, k;
string p, s, res;
bool vis[N];
void Enter() {
  cin >> n >> k >> p >> s;
  m = p.size(), p = ' ' + p, s = ' ' + s;
}
int Attemp(int pos, int c) {
  res[pos] = char(c + 'a');
  int ans = 0;
  for (int i = max(0, pos - m + 1); i <= pos; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (p[j] == res[i + j - 1]) {
        if (j == m) return m + 1;
      } else {
        ans = max(ans, j);
        break;
      }
    }
  }
  return ans;
}
bool Check() {
  p.erase(0, 1);
  for (int i = 1, lim = n - m + 1; i <= lim; ++i) {
    if (s[i] == '1' && res.substr(i - 1, m) != p) return 0;
    if (s[i] == '0' && res.substr(i - 1, m) == p) return 0;
  }
  return 1;
}
void Solve() {
  res.resize(n);
  for (int i = 1, lim = n - m + 1; i <= lim; ++i) {
    if (s[i] == '1') {
      for (int j = 1; j <= m; ++j) {
        if (!vis[i + j - 1])
          res[i + j - 2] = p[j];
        else if (res[i + j - 2] != p[j]) {
          cout << "No solution\n";
          return;
        }
        vis[i + j - 1] = 1;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (vis[i + 1]) continue;
    int t, Min = 100, c;
    for (int j = 0; j < k; ++j) {
      if ((t = Attemp(i, j)) < Min) Min = t, c = j;
    }
    res[i] = c + 'a';
  }
  if (!Check())
    cout << "No solution\n";
  else
    cout << res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (fopen("test"
            ".inp",
            "r")) {
    freopen(
        "test"
        ".inp",
        "r", stdin);
    freopen(
        "test"
        ".out",
        "w", stdout);
  }
  Enter(), Solve();
  return 0;
}
