#include <bits/stdc++.h>
using namespace std;
template <class T>
int size(const T& a) {
  return (int)a.size();
}
template <class T>
T sqr(const T& a) {
  return a * a;
}
char s1[200], s2[200];
int p[200];
char res[200];
int main() {
  int n, k;
  cin >> n >> k;
  cin >> s1;
  int m = strlen(s1);
  cin >> s2;
  for (int i = 0; i < n - m + 1; i++) {
    if (s2[i] == '1') {
      for (int j = 0; j < m; j++) {
        if (res[i + j] && res[i + j] != s1[j]) {
          printf("No solution");
          return 0;
        }
        res[i + j] = s1[j];
      }
    } else {
      if (k == 1) {
        printf("No solution");
        return 0;
      }
    }
  }
  p[1] = 0;
  for (int i = 1, u = 0; i < m; i++) {
    while (u > 0 && s1[u] != s1[i]) u = p[u];
    if (s1[u] == s1[i]) u++;
    p[i + 1] = u;
  }
  for (int i = 0, u = 0; i < n; i++) {
    if (!res[i]) {
      if (s1[u] == 'a') {
        res[i] = 'b';
      } else {
        res[i] = 'a';
      }
    }
    while (u > 0 && s1[u] != res[i]) u = p[u];
    if (s1[u] == res[i]) u++;
    if (u == m) {
      if (s2[i - m + 1] == '0') {
        printf("No solution");
        return 0;
      }
      u = p[u];
    }
  }
  cout << res;
  return 0;
}
