#include <bits/stdc++.h>
using namespace std;
const int A = 26;
const int N = 103;
char s[N];
int bord[N];
int trans[N][A];
bool dp[N][N];
int pj[N][N];
int pc[N][N];
int m;
void calc_bord() {
  for (int i = 2; i <= m; ++i) {
    int k = bord[i - 1];
    while (k > 0 && s[k + 1] != s[i]) k = bord[k];
    if (s[k + 1] == s[i]) ++k;
    bord[i] = k;
  }
}
void calc_trans() {
  trans[0][s[1] - 'a'] = 1;
  for (int i = 1; i <= m; ++i)
    for (int j = 0; j < A; ++j) {
      if (s[i + 1] == j + 'a')
        trans[i][j] = i + 1;
      else
        trans[i][j] = trans[bord[i]][j];
    }
}
void print(int i, int j) {
  if (i == 0) return;
  print(i - 1, pj[i][j]);
  printf("%c", (char)pc[i][j] + 'a');
}
int main() {
  int n, k;
  scanf("%d%d%s", &n, &k, s + 1);
  m = strlen(s + 1);
  calc_bord();
  calc_trans();
  scanf("%s", s + 1);
  for (int i = n; i - m + 1 > 0; --i) s[i] = s[i - m + 1];
  for (int i = m - 1; i > 0; --i) s[i] = '0';
  dp[0][0] = true;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= m; ++j)
      if (dp[i][j]) {
        for (int c = 0; c < k; ++c) {
          dp[i + 1][trans[j][c]] = true;
          pj[i + 1][trans[j][c]] = j;
          pc[i + 1][trans[j][c]] = c;
        }
      }
    if (s[i + 1] == '0')
      dp[i + 1][m] = false;
    else {
      for (int j = 0; j < m; ++j) dp[i + 1][j] = false;
    }
  }
  int j = -1;
  for (int k = 0; k <= m; ++k)
    if (dp[n][k]) {
      j = k;
      break;
    }
  if (j != -1) {
    print(n, j);
    printf("\n");
  } else
    puts("No solution");
  return 0;
}
