import java.util.*;
// Please name your class Main
public class delete1 {
public static void main (String[] args) throws java.lang.Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt(); int max = 0;
int k = in.nextInt();
long []arr = new long[n];
for(int i=0;i<n;i++) {
arr[i]= in.nextLong();
}
long p=1;
int oldcount=0, larger=0;
int[] binary = new int[(int) Math.pow(2, n)];
for (int i = 0; i < Math.pow(2, n); i++)
{
oldcount=0;
p=1;
int b = 1;
binary[i] = 0;
int num = i, count = 0;
while (num > 0)
{
if (num % 2 == 1)
count++;
binary[i] += (num % 2) * b;
num /= 2;
b = b * 10;
}
if (count == k)
{
//System.out.print("{ ");
for (int j = 0; j < n; j++)
{
if (binary[i] % 10 == 1)
p = p * arr[j] ;
binary[i] /= 10;
}
}
String s =Long.toString(p);
StringBuilder s1 = new StringBuilder();
s1.append(s);
s1 = s1.reverse();
for(int h=0;h<s1.length();h++) {
if(s1.charAt(h)=='0') {
oldcount++;
}else {
break;
}
}
if(larger<oldcount) {
larger = oldcount;
}
}
System.out.println(larger);
}
}
Giving memory Limit Exceeded