import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int k = sc.nextInt(); int[] values = new int[n]; Num[] inputs = new Num[n]; for (int i = 0; i < n; i++) { values[i] = sc.nextInt(); inputs[i] = new Num(values[i]); } int[] sums = new int[1 << n]; Num[] nums = new Num[1 << n]; nums[0] = new Num(1); HashSet ans = new HashSet<>(); for (int i = 1; i < (1 << n); i++) { for (int j = 0; j < n; j++) { if ((i & (1 << j)) > 0) { sums[i] = sums[i ^ (1 << j)] + values[j]; nums[i] = nums[i ^ (1 << j)].multiply(inputs[j]); break; } } if (getPop(i) >= k) { ans.add(new Num(sums[i])); ans.add(nums[i]); } } System.out.println(ans.size()); } static int getPop(int x) { int pop = 0; while (x > 0) { pop += x % 2; x >>= 1; } return pop; } static class Num { HashMap count = new HashMap<>(); public Num(int x) { for (int i = 2; i <= Math.sqrt(x); i++) { while (x % i == 0) { count.put(i, count.getOrDefault(i, 0) + 1); x /= i; } } if (x > 1) { count.put(x, count.getOrDefault(x, 0) + 1); } } public int hashCode() { return count.size(); } public Num multiply(Num another) { Num ans = new Num(1); for (int x : count.keySet()) { ans.count.put(x, count.get(x)); } for (int x : another.count.keySet()) { ans.count.put(x, ans.count.getOrDefault(x, 0) + another.count.get(x)); } return ans; } public boolean equals(Object o) { Num z = (Num)o; if (z.count.size() != count.size()) { return false; } for (int x : count.keySet()) { if (!z.count.containsKey(x) || count.get(x) != z.count.get(x)) { return false; } } return true; } } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }