import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String t,ss;
int length;
int a = sc.nextInt();
int b = sc.nextInt();
t = sc.nextLine();//截取换行字符
String s = sc.nextLine();
for (int i = 0; i <= a-b; i++) {
String s1 = s.substring(i,i+b);
int n = Integer.parseInt(s1);
if(sus(n)) {
ss = Integer.toString(n);
length = ss.length();
for(int j=0;j<b-length;j++) {
System.out.print("0");
}
System.out.println(n);
System.exit(0);;
}
}
System.out.println("404");
}
public static boolean sus(int n) {
if(n==0||n==1) {
return false;
}else {
for(int i=2;i<=Math.sqrt(n);i++) {
if(n%i==0) {
return false;
}
}
return true;
}
}
}
08-19
744
05-17
713
01-31
525