#include <bits/stdc++.h>
using namespace std;
int n,k,ans;
int a[25];
bool prime(int x){
if(x<2) return 0;
for(int i=2;i*i<=x;i++){
if(!(x%i)) return 0;
}
return 1;
}
void work(int h,int b,int s){
if(!h){
cout<<s<<"\n";
if(prime(s)){
ans++;
}
return;
}
for(int xhr=b;xhr<=n;xhr++){
work(h-1,b+1,s+a[xhr]);
}
return;
}
int main(){
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
work(k,i,ans);
}
cout<<ans;
return 0;
}