#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define PII pair<int,int>
#define f first
#define s second
#define PB push_back
#define MIN(a,b) a=min(a,b)
#define MAX(a,b) a=max(a,b)
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()
#define V vector
#define PDI pair<double, int> 
#define Pll pair<ll,ll>
const int N=1e5;
const ll mod=1e9+7;
const double eps=1e-9;
const double PI=acos(-1);
#define INF 2000000000

int n,m,k;
V<int> g[N];
int g1[N];
bool b[N];
V<int> pss;

void dfs0(int x, int y){
	b[x]=1;
	if(g[x].size()!=1){
		k++;
		g1[y]=x;
		for(auto to:g[x]){
			if(b[to])
				continue;
			dfs0(to,to);
		}
		return;
	}
	int s=0;
	for(auto to:g[x]){
		if(b[to])
			continue;
		s++;
		dfs0(to,y);
	}
	if(!s){
		k++;
		g1[y]=x;
	}
}

void dfs1(int x){
	if(g1[x]==-1)
		return;
	b[x]=1;
	pss.PB(x);
	int y=x;
	x=g1[x];
	for(auto to:g[x]){
		if(b[to])
			if(to==0&&pss.size()==k)
				return;
			else
				continue;
		dfs1(to);
		if(g1[pss[pss.size()-1]]!=x)
			return;
	}
	b[y]=0;
	pss.pop_back();
}

int main(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		x--;
		y--;
		g[x].PB(y);
	}
	memset(g1,255,sizeof g1);
	dfs0(0,0);
	memset(b,0,sizeof b);
	dfs1(0);

	// for(int i=0;i<n;i++)
	// 	cout<<g1[i]<<' ';
	// cout<<"\n";

	if(pss.size()==0){
		cout<<"NO";
		return 0;
	}
	cout<<"YES\n";
	for(auto x:pss){
		int x1=x;
		while(x1!=g1[x]){
			cout<<x1+1<<' ';
			x1=g[x1][0];
		}
		cout<<x1+1<<' ';
	}
	cout<<1;
}