#include <bits/stdc++.h>
using namespace std;
char s[105], pos[105], p[105], cmp[105];
int main() {
  int n = 0, k = 0;
  scanf("%d%d", &n, &k);
  scanf("%s", p);
  scanf("%s", pos);
  for (int i = 0; i < n; ++i) {
    s[i] = '*';
  }
  int lenp = strlen(p);
  for (int i = 0; i < n - lenp + 1; ++i) {
    if (pos[i] == '1') {
      for (int j = 0; j < lenp; ++j) {
        s[i + j] = p[j];
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    bool isSame = true;
    for (int j = 0; j < lenp && i + j < n; ++j) {
      if (s[i + j] == '*') {
        s[i + j] = p[j] == 'a' ? 'b' : 'a';
        isSame = false;
        break;
      } else if (s[i + j] != p[j]) {
        if (pos[i] == '1') {
          printf("No solution");
          return 0;
        } else {
          isSame = false;
          break;
        }
      }
    }
    if (isSame && pos[i] == '0') {
      printf("No solution");
      return 0;
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%c", s[i]);
  }
  return 0;
}
