#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 9;
bool putAndCheck(const char *word, int *dest) {
  for (int i = 0, _ = (strlen(word)); i < _; ++i) {
    int x = word[i] - 'a';
    if (dest[i] == -1 || dest[i] == x) {
      dest[i] = x;
    } else {
      return false;
    }
  }
  return true;
}
char word[102], pos[102];
int n, k, t[102], wlen;
bool collide(int i) {
  if (pos[i] == '1') return false;
  for (int j = 0, _ = (wlen); j < _; ++j) {
    if (t[i + j] != -1 && t[i + j] != word[j] - 'a') return false;
  }
  return true;
}
bool f(int i) {
  if (i == n) return true;
  if (t[i] != -1) {
    int pre = i - wlen + 1;
    if (pre >= 0 && collide(pre)) {
      return false;
    }
    return f(i + 1);
  }
  for (int c = 0, _ = (k); c < _; ++c) {
    t[i] = c;
    int pre = i - wlen + 1;
    if (pre >= 0 && collide(pre)) {
      continue;
    }
    if (f(i + 1)) {
      return true;
    }
  }
  return false;
}
void inline jeden() {
  scanf("%d%d", &n, &k);
  for (int i = 0, _ = (n); i < _; ++i) {
    t[i] = -1;
  }
  scanf("%s", word);
  scanf("%s", pos);
  bool no_solution = false;
  for (int i = 0, _ = (strlen(pos)); i < _; ++i) {
    if (pos[i] == '1') {
      if (!putAndCheck(word, t + i)) {
        no_solution = true;
        break;
      }
    }
  }
  if (no_solution) {
    puts("No solution");
    return;
  }
  wlen = strlen(word);
  for (int i = 0, _ = (n); i < _; ++i) {
  }
  if (f(0)) {
    for (int i = 0, _ = (n); i < _; ++i) {
      putchar(t[i] + 'a');
    }
    for (int i = 0, _ = (n); i < _; ++i) {
    }
    puts("");
  } else {
    puts("No solution");
  }
}
int main() { jeden(); }
