import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; import java.math.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int k = sc.nextInt(); List values = IntStream.range(0, n).mapToObj(i -> new BigInteger(sc.next())).toList(); BigInteger[] sum = new BigInteger[1 << n]; BigInteger[] multi = new BigInteger[1 << n]; sum[0] = new BigInteger("0"); multi[0] = new BigInteger("1"); HashSet ans = new HashSet<>(); IntStream.range(1, 1 << n).forEach(i -> { int idx = IntStream.range(0, n).filter(j -> (i & (1 << j)) > 0).findFirst().orElse(0); sum[i] = sum[i ^ (1 << idx)].add(values.get(idx)); multi[i] = multi[i ^ (1 << idx)].multiply(values.get(idx)); if (getPop(i) >= k) { ans.add(sum[i]); ans.add(multi[i]); } }); System.out.println(ans.size()); } static int getPop(int x) { int pop = 0; while (x > 0) { pop += x % 2; x >>= 1; } return pop; } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }