//给定n个整数ai,求是否可选出若干个数,使它们的和恰好为k
//n <= 20
// example 1
//n = 4
//a = {1 2 4 7}
//k = 13
#include <iostream>
#include <stack>
using namespacestd;
int n,k,a[22],suit[22] ,num =0;
stack<int> p;
bool dfs(int i,int sum)
{
//出口
if (i ==n) {
return sum ==k;//等于返回true,符合条件
}
//跳过第i个数,不取
if (dfs(i +1, sum)) {
returntrue;//当取到最后一个数符合时,一层层返回true
}
//取第i个数
if (dfs(i +1, sum + a[i])) {
p.push(a[i]);
returntrue;
}
//取不取第i个数都凑不成k时,返回false
returnfalse;
}
int main()
{
cin >>n;
for (int i =0; i < n; i ++) {
cin >>a[i];
}
cin >>k;
if(dfs(0,0)) cout <<"yes" << endl;
else cout << "no" <<endl;
//只给出一种符合的可能
while (!p.empty()) {
cout <<p.top() <<" ";
p.pop();
}
return0;
}