#include <iostream>
using namespace std;
struct camera{int dest;bool a_fost=false;};
camera cam[100000];
int trecut[100000];
int main(){
int n,h;
cin>>n>>h;
for(int i = 1;i<=n;i++)
{
cin >> cam[i].dest;
}
cam[1].a_fost = true;
trecut[0]=1;
int ptr = 1;
int pos = 1;
while(!cam[h].a_fost){
pos = cam[pos].dest;
trecut[ptr++]=pos;
if(cam[pos].a_fost){cout << "NU";return 0;}
cam[pos].a_fost = true;
}
cout << "DA";
for(int i = 0; i < ptr;i++){
cout << trecut[i] << " ";
}
}