//1152 Google Recruitment :Find prime
#include
#include
#include
#include
using namespace std;
bool find(string a) {
int b = stoi(a);
int i;
//if (b == 3) return true;
if (b == 2) return true;
if (b == 1)return false;
for (i = 2; i*i <= b; i++) {
if (b%i == 0)
return false;
}
return true;
}
int main() {
int L, K;
cin >> L >> K;
string s;
cin >> s;
bool isfind = false;
for (int i = 0; i + K <= s.length(); i++) {
string a(s, i, K);
if (find(a)) {
cout << a;
isfind = true;
break;
}
}
if (isfind == false)
cout << "404";
return 0;
}