#include <bits/stdc++.h>
using namespace std;
int F[105];
int m[105][105], n, k, len;
string name, is;
int f(int p, int match) {
  if (p == n) return 1;
  int& ret = m[p][match];
  if (ret != -1) return ret;
  if (match == len) match = F[len];
  ret = 0;
  bool matched = 0;
  for (int ch('a'), _e('a' + k); ch <= _e; ch++) {
    bool dark = 0;
    int newmatch = match;
    while (!dark) {
      if (ch == name[newmatch]) {
        ++newmatch;
        if (newmatch == len) {
          matched = 1;
          if (is[p - len + 1] == '1')
            break;
          else {
            dark = 1;
            break;
          }
        } else
          break;
      } else if (newmatch > 0)
        newmatch = F[newmatch];
      else
        break;
    }
    if (dark) continue;
    if (f(p + 1, newmatch)) ret = 1;
  }
  if (p + 1 >= len && is[p - len + 1] == '1' && !matched) return ret = 0;
  return ret;
}
string ans;
void print(int p, int match) {
  if (p == n) return;
  for (int ch('a'), _e('a' + k); ch <= _e; ch++) {
    bool dark = 0;
    int newmatch = match;
    bool matched = 0;
    while (!dark) {
      if (ch == name[newmatch]) {
        ++newmatch;
        if (newmatch == len) {
          matched = 1;
          if (is[p - len + 1] == '1')
            break;
          else {
            dark = 1;
            break;
          }
        } else
          break;
      } else if (newmatch > 0)
        newmatch = F[newmatch];
      else
        break;
    }
    if (dark) continue;
    if (p + 1 >= len && is[p - len + 1] == '1' && !matched) {
      continue;
    }
    if (f(p + 1, newmatch)) {
      ans += ch;
      if (p + 1 != n) print(p + 1, newmatch);
      break;
    }
  }
}
int main() {
  cin >> n >> k;
  cin >> name >> is;
  len = name.size();
  --k;
  for (int i = 0, _e(is.size()); i < _e; i++)
    if (is[i] == '1' && i + len > n) {
      printf("No solution\n");
      return 0;
    }
  F[0] = F[1] = 0;
  for (int i(2), _e(len); i <= _e; i++) {
    int j = F[i - 1];
    while (true) {
      if (name[j] == name[i - 1]) {
        F[i] = j + 1;
        break;
      } else if (!j) {
        F[i] = 0;
        break;
      } else
        j = F[j];
    }
  }
  memset((m), (-1), sizeof(m));
  if (f(0, 0)) {
    print(0, 0);
    if (ans.size() == n) {
      cout << ans << endl;
      return 0;
    }
  }
  printf("No solution\n");
  return 0;
}
