/*
ZADATAK: proizvod
JEZIK: C++
*/
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

int N = 0;
int M = 0;
char * S = 0;

void read()
{
  FILE * fi = fopen("proizvod.in","r");
  fscanf(fi,"%d %d\n",&N,&M);
  S = new char[N+10];
  fscanf(fi,"%s",S);
#ifdef debug
  assert(N==strlen(S));
#endif
  fclose(fi);
}

void calc()
{
  FILE * fo = fopen("proizvod.out","w");
  vector<char> b;
  vector<char> s;
  sort(S,S+N);
#ifdef debug
  printf("%s\n",S);
#endif
  {
    char * p = S+N-1;
    char biggest = *p;
    do
    {
      b.push_back(*p--);
      if (p>=S)
        s.push_back(*p);
    }
    while (p>=S && *p--==biggest);
    while (p>=S)
    {
      s.push_back(*p--);
      if (p>=S)
        b.push_back(*p--);
    }
  }
  {
    char s1[10] = {0,0,0,0,0,0,0,0,0,0};
    char s2[10] = {0,0,0,0,0,0,0,0,0,0};
    int n;
    n = min((int) b.size(),9);
    copy(b.begin()+b.size()-n,b.end(),s1);
    n = min((int) s.size(),9);
    copy(s.begin()+s.size()-n,s.end(),s2);
#ifdef debug    
    printf("%s\n%s\n",s1,s2);
#endif
    long long l1 = atoll(s1);
#ifdef debug    
    cout << l1 << endl;
#endif
    long long l2 = atoll(s2);
#ifdef debug    
    cout << l2 << endl;
#endif
    long long llres = l1 * l2;
#ifdef debug    
    cout << llres << endl;
#endif
    char sres[30];
    for (int i=M-1; i>=0; i--)
    {
      long long m = 1;
      for (int j=0; j<i; j++)
        m*=10;
      fprintf(fo,"%d", (llres / m) % 10);
    }
    fprintf(fo,"\n");
  }
}

int main(int argc, char *argv[])
{
  read();
  calc();
  return EXIT_SUCCESS;
}
