#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int t,n,m,k,l,r,op,y;
string x;
ll dfs(ll num,ll ws,ll k){
if(ws>n){
if(!k)return num;
return 0;
}
ll ans = dfs(num*10+x[ws]-'0',ws+1,k);
if(k){
ans = max(ans,num*dfs(x[ws]-'0',ws+1,k-1));
}
return ans;
}
void solve(){
cin>>n>>k;
cin>>x;
x='~'+x;
cout<<dfs(0,1,k);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}