#include<bits/stdc++.h>
using namespace std;
int t, n, k, a[100050], uvazenost;
bool flag1, flag2, flag3, flag4;

void PRVI_SET()
{
    uvazenost = 0;
    for(int i=1; i<=n; i++)
    {
        if(uvazenost <= a[i])
            uvazenost++;
        else
            uvazenost--;
        //cout << a[i] << " ";
    }

    if(uvazenost == k)
    {
        cout << "DA\n";
        if(t == 1)
        {
            for(int i=1; i<=n; i++)
                cout << a[i] << " ";
            cout << "\n";
        }
        return;
    }
    cout << "NE\n";
}


void DRUGI_SET()
{
    do{
        uvazenost = 0;
        for(int i=1; i<=n; i++)
        {
            if(uvazenost <= a[i])
                uvazenost++;
            else
                uvazenost--;

            //cout << a[i] << " ";
        }
        //cout << ": " << uvazenost << "\n";

        if(uvazenost == k)
        {
            cout << "DA\n";

            if(t == 1)
            {
                for(int i=1; i<=n; i++)
                    cout << a[i] << " ";
                cout << "\n";
            }
            return;
        }

    }while(next_permutation(a+1, a+n+1));
    cout << "NE\n";
    return;
}

int main()
{
    cin >> t;
    cin >> n >> k;
    for(int i=1; i<=n; i++)
        cin >> a[i];
    sort(a+1, a+n+1);

    flag1 = 1;
    for(int i=2; i<=n; i++)
    {
        if(a[i] != a[1])
        {
            flag1 = 0;
            break;
        }
    }

    if(n<=8)
        flag2 == 1;

    if(flag1)
    {
        PRVI_SET();
        return 0;
    }

    if(flag2)
    {
        DRUGI_SET();
        return 0;
    }

    else
        cout << "NE\n";
    return 0;
}