import std; import core.bitop; void main() { int N, K; readf("%d %d\n", N, K); auto A = readln.chomp.split.to!(long[]); bool[long] list; foreach (i; 0 .. 2^^N) { if (i.popcnt < K) { continue; } long S, M = 1; foreach (j; 0 .. N) { if ((i >> j) & 1) { S += A[j]; M *= A[j]; } } list[S] = true, list[M] = true; } list.length.writeln; }