```cpp
#include <bits/stdc++.h>
using namespace std;
long long ans,n,k,a[25];
bool cmp(int a){
for(int i = 2; i <= sqrt(a); i ++){
if(a % i == 0){
return false;
}
} //判断是否为质数
return true;
}
void dfs(int m, int sum, int s){
if(m == k){
if(cmp(sum))
ans ++;
}
for(int i = s; i < n; i++)
dfs(m + 1, sum + a[i], i + 1);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
for(int i = 0; i < n; i++){
cin >> a[i];
}
dfs(0, 0, 0);
cout << ans;
return 0;
}
```
by Lg2307 @ 2024-03-25 20:57:28
@[Pocon](/user/1310268)
arr[x]=k[i];
arr[x]=0;
那里是x不是i;
by formula2002 @ 2024-03-25 22:11:16