#include <bits/stdc++.h>

using namespace std;

#define DIM 100037

long long n, m, vis[DIM], mx[DIM], u, v, nxt[DIM], it;

vector<long long> vec[DIM];

void dfs(long long v){
    vis[v]=1;
    mx[v]=-1;
    for(auto to : vec[v]){
        if(to==1){
            mx[v]=max(mx[v], 1LL);
            nxt[v]=1;
        }
        if(vis[to]==1) continue;
        if(vis[to]==2){
            if(mx[to]!=-1 && mx[to]+1>mx[v]){
                mx[v]=mx[to]+1;
                nxt[v]=to;
            }
        }
        dfs(to);
        if(mx[to]!=-1 && mx[to]+1>mx[v]){
            mx[v]=mx[to]+1;
            nxt[v]=to;
        }
    }
    vis[v]=2;
    return;
}

int main(){
    cin>>n>>m;
    for(int i=1; i<=m; i++){
        cin>>u>>v;
        vec[u].push_back(v);
    }
    dfs(1);
    if(mx[1]!=n){
        cout<<"NO";
        return 0;
    }
    it=nxt[1];
    cout<<"YES"<<endl;
    cout<<1<<' ';
    while(it!=1){
        cout<<it<<' ';
        it=nxt[it];
    }
    cout<<1<<' ';
    return 0;
}
