#include <bits/stdc++.h>
using namespace std;
const int MAXT = 100000;
int p[1000];
bool cmp(string str, int len, string& tem) {
  p[0] = 0;
  for (int i = 1, k = 0; i < str.size(); i++) {
    while (k > 0 && str[k] != str[i]) k = p[k - 1];
    if (str[i] == str[k]) k++;
    p[i] = k;
  }
  bool f = true;
  for (int i = len + len, k = 0; k < tem.size(); i++, k++)
    if (p[i] == len && tem[k] != '1') f = false;
  return f;
}
int main() {
  srand(time(0));
  int n, m;
  cin >> n >> m;
  string s1, s2;
  cin >> s1 >> s2;
  string s3(n, '0'), t;
  for (int i = 0; i < n - s1.size() + 1; i++)
    if (s2[i] == '1')
      for (int j = i, k = 0; k < s1.size(); j++, k++) {
        if (s3[j] == '0' || s3[j] == s1[k])
          s3[j] = s1[k];
        else {
          cout << "No solution";
          return 0;
        }
      }
  for (int i = 0; i < n; i++) {
    if (s3[i] == '0') {
      int h = 10000, b;
      for (int j = 0; j < m; j++) {
        s3[i] = 'a' + j;
        cmp(s1 + "$" + s3, s1.size(), s2);
        if (p[s1.size() + 1 + i] < h) {
          h = p[s1.size() + 1 + i];
          b = j;
        }
      }
      s3[i] = 'a' + b;
    }
  }
  if (cmp(s1 + "$" + s3, s1.size(), s2))
    cout << s3;
  else
    cout << "No solution";
  return 0;
}
