#include <bits/stdc++.h>
using namespace std;
vector<int> p_rez;
void permutacije(int& n, int& k, vector<int>& a, vector<int> tr,vector<bool> uzeti){
	int m = tr.size();
	if (m == n){
		int p = 0;
		for (int i = 0; i < n;i++){
			if (p<= a[i]) p++;
			else p--;
			
		}
		if (p==k){
			p_rez = tr;
		}
		return;
		
	}
	
	for (int i = 0; i < n;i++){
		if (!uzeti[i]){
			tr.push_back(a[i]);
			uzeti[i] = true;
			permutacije(n,k,a,tr,uzeti);
		}
	}
}

int main(int argc, char** argv) {
	
	int T;
	cin>>T;
	int n,k;
	cin>>n>>k;
	vector<int> a(n);
//	bool test1 = false;
	for (int i = 0; i <n; i++){
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	if (n <= 8){
		vector<int> tr;
		vector<bool> uzeti(n,false);
		permutacije(n,k,a,tr,uzeti);
		if (p_rez.size() == 0){
			cout<<"NE\n";
		} 
		else{
			cout<<"DA\n";
			if (T==1) for (int i = 0; i < n; i++) cout<<p_rez[i]<<' ';
		}
	}
	else if (a[0] == a[n-1]){   // TEST 1 a[i] je isto
		int tr = 0;
		for (int i = 0;i<n; i++){
			if (tr<=a[i]) tr++;
			else tr--;
		}
		if (tr != k) cout<<"NE\n";
		else{
			if (T==0) cout<<"DA\n";
			else{
				cout<<"DA\n";
				for (int i = 0;i < n;i++) cout<<a[i]<<" ";
			}
			
		}
	}

	
	return 0;
}