#include <bits/stdc++.h>

using namespace std;

#define fr first
#define sc second

typedef long long ll;
const ll INF = 100000000007, DIM = 200007, MAXN = 100000;

ll tt, a[DIM], used[DIM], sz[DIM], cnt[DIM], x, b[DIM], t[DIM], v,u,n,m,res, c, l, r;
string s;
vector<ll> g[DIM], g2[DIM], path;

void dfs(ll v) {
	path.push_back(v);
	used[v]=1;
	for(auto u : g[v]) {
		if(used[u]==1&&u==1&&path.size()+res==n){
			cout<<"YES\n";
			for(auto u : path){
                cout<<u<<" ";
                x=u;
                for(int j=1;j<=sz[u];++j){
                    x=g2[x][0];
                    cout<<x<<" ";
                }
            }
			cout<<"1\n";
			exit(0);
		}
		if(used[u]!=1){
            res+=sz[v];
			dfs(u);
		}
	}
	used[v]=2;
	path.pop_back();
    res-=sz[v];
}

ll dfs2(ll v) {
    used[v]=1;
    sz[v]=0;
    if(g[v].size()==1){x=v;t[v]=1;}
    for(auto u : g[v]){
        if(!used[u]){
            x=dfs2(u);
            if(g[v].size() ==1 && x!=-1){
                t[v]=0;
                sz[v]=sz[u]+1 - (t[u]);
                g[v].clear();
                g[v].push_back(x);
            }
        }
    }
    if(g[v].size()!=1)return -1;
    return x;
}

void solve(){
	cin>>n>>m;
	for(int i=1;i<=m;++i){
		cin>>v>>u;
		g[v].push_back(u);
        g2[v].push_back(u);
	}
    dfs2(1);
    for(int i=1;i<=n;++i)used[i]=0;
	dfs(1);
	cout<<"NO\n";
}

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