#include <bits/stdc++.h>
using namespace std;
int n, k;
set<int> st;
set<int>::iterator it;
string s, ans;
bool is_end;
vector<int> v;
bool check() {
  int x = ans.find(s, 0);
  set<int> tmp;
  while (x != -1) {
    tmp.insert(x);
    x = ans.find(s, x + 1);
  }
  return (st == tmp);
}
void solve(int i) {
  if (is_end || (i < ans.size() && ans[i] != '*')) return solve(i + 1);
  if (i >= ans.size()) {
    if (check()) is_end = true;
    return;
  }
  for (char ch = 'a'; ch < 'a' + k; ch++) {
    ans[i] = ch;
    solve(i + 1);
    if (is_end) break;
  }
}
int main() {
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < n - s.size() + 1; i++) {
    char ch;
    cin >> ch;
    if (ch == '1') st.insert(i);
  }
  for (int i = 0; i < n; i++) ans.push_back('*');
  for (it = st.begin(); it != st.end(); it++)
    for (int i = *it, j = 0; j < s.size(); i++, j++) {
      if (ans[i] == '*' || ans[i] == s[j])
        ans[i] = s[j];
      else if (ans[i] != s[j]) {
        cout << "No solution";
        return 0;
      }
    }
  solve(0);
  if (is_end)
    cout << ans;
  else
    cout << "No solution";
  return 0;
}
