{
ZADATAK: proizvod
JEZIK: pascal
}
program Proizvod;

var
inp,outp:text;
a,marza,cena:array[1..100000] of SHORTINT;
i,ba,bm,bc,bmb,bcb,n:longint;
ch:char;
veci,vise,m:shortint;
proiz,mbroj,cbroj:Int64;
mniz:array[1..8] of SHORTINT;


procedure Sort(l, r: longint);
var
  i, j, x, y: longint;
begin
  i := l; j := r; x := a[(l+r) DIV 2];
  repeat
    while a[i] < x do i := i + 1;
    while x < a[j] do j := j - 1;
    if i <= j then
    begin
      y := a[i]; a[i] := a[j]; a[j] := y;
      i := i + 1; j := j - 1;
    end;
  until i > j;
  if l < j then Sort(l, j);
  if i < r then Sort(i, r);
end;




begin
  assign(inp,'proizvod.in');
  assign(outp,'proizvod.out');
  reset(inp);
  readln(inp,n,m);
  ba:=0;
  for i:=1 to n do
      begin
        read(inp,ch);
        a[i]:=ord(ch)-ord('0');
      end;
  close(inp);
  Sort(1,n);
  bm:=1;
  bc:=1;
  cena[1]:=a[n];
  marza[1]:=a[n-1];
  if marza[1]>cena[1] then veci:=-1 else if cena[1]>marza[1] then veci:=1 else veci:=0;
  vise:=0;
  for i:=n-2 downto 1 do
      begin
        if vise=1 then
           begin
             Inc(bm);
             marza[bm]:=a[i];
             vise:=0;
             if veci=0 then
                  if marza[bm]>cena[bc] then veci:=-1 else if cena[bc]>marza[bm] then veci:=1 else veci:=0;
           end
        else if vise=-1 then
           begin
             Inc(bc);
             cena[bc]:=a[i];
             vise:=0;
             if veci=0 then
                  if marza[bm]>cena[bc] then veci:=-1 else if cena[bc]>marza[bm] then veci:=1 else veci:=0;

           end
        else if vise=0  then
           begin
             if veci=1 then
                 begin
                   Inc(bm);
                   marza[bm]:=a[i];
                   vise:=-1;
                 end
             else
                 begin
                   Inc(bc);
                   cena[bc]:=a[i];
                   vise:=1;
                 end

           end;    {end vise=0}
     end; {end for};
mbroj:=marza[1];
cbroj:=cena[1];
bmb:=2;
bcb:=2;
for i:=m-1 downto 1 do
  begin
    if bmb<=bm then mbroj:=10*mbroj+marza[bmb];
    if bcb<=bc then cbroj:=10*cbroj+cena[bcb];
    Inc(bmb);
    Inc(bcb);
  end;
proiz:=mbroj*cbroj;
for i:=1 to 8 do mniz[i]:=0;
i:=m;
while (proiz>=10) and (i>0) do
begin
  mniz[i]:=Proiz mod 10;
  Proiz:=Proiz div 10;
  Dec(i);
end;
if (i>0) then mniz[i]:=Proiz;
rewrite(outp);
for i:=1 to m do
 begin
   ch:=chr(ord('0')+mniz[i]);
   write(outp,ch);
 end;
close(outp);
end.



