#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long int lint;

bool uspelo = false;

void generisi(vector<int>& a, vector<bool> mark, vector<int> uzeti, int trenzau, int tr, int k, int t){
    if(trenzau == a.size()){
        if(tr == k){
            if(uspelo){
                return;
            }
            cout << "DA" << endl;
            uspelo = true;
            if(t == 1){
                for(int i = 0; i < a.size(); i++){
                    cout << uzeti[i] << " ";
                }
                cout << endl;
            }

        }
        return;
    }
    int n = a.size();
    for(int i = 0; i < n; i++){
        if(!mark[i]){
            vector<bool> mark2 = mark;
            mark2[i] = true;
            vector<int> novivektor = uzeti;
            novivektor.push_back(a[i]);
            int inkr;
            if(tr <= a[i]){
                inkr = 1;
            }
            else{
                inkr = -1;
            }
            generisi(a, mark2, novivektor, (trenzau + 1), (tr + inkr), k, t);
        }
    }
}


void solve(){
    int t;
    cin >> t;
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    bool sviisti = true;
    bool trecipod = true;
    bool cetvrtipod = true;
    for(int i = 0; i < n; i++){
        if(a[0] != a[i]){
            sviisti = false;
        }
        if((a[i] != 1) && (a[i] != -1)){
            trecipod = false;
        }
        if(a[i] != (i + 1)){
            cetvrtipod = false;
        }
    }


    if(sviisti){
        int tr = 0;
        for(int i = 0; i < n; i++){
            if(tr <= a[i]){
                tr++;
            }
            else{
                tr--;
            }
        }
        if(tr == k){
            cout << "DA" << endl;
            if(t == 1){
                for(int i = 0; i < n; i++){
                    cout << a[i] << " ";
                }
                cout << endl;
            }
        }
        else{
            cout << "NE" << endl;
        }
        return;
    }

    if(n <= 8){
        vector<bool> mark(n, false);
        vector<int> uzeti;
        generisi(a, mark, uzeti, 0, 0, k, t);
        if(!uspelo){
            cout << "NE" << endl;
        }
        return;
    }
/*
    else if((n <= 500) && (trecipod)){
        if((k < -1) || (k > 2)){
            cout << "NE" << endl;
        }
        int c1 = 0;
        int c1p = 0;
        for(int i = 0; i < n; i++){
            if(a[i] == 1){
                c1++;
            }
            else{
                c1p++;
            }
        }

    }
    else if((n <= 500) && (cetvrtipod)){

    }
*/

    sort(a.begin(), a.end());
    int tr = 0;
    for(int i = 0; i < n; i++){
        if(a[i] >= tr){
            tr++;
        }
        else{
            tr--;
        }
    }
    if(tr == k){
        cout << "DA" << endl;
        if(t == 1){
            for(int i = 0; i < n; i++){
                cout << a[i] << " ";
            }
            cout << endl;
        }
    }
    else{
        cout << "NE" << endl;
    }

}


signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}