#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pll pair<ll, ll>
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef __gnu_pbds::tree<ll, __gnu_pbds::null_type, less<ll>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update> yree;
const ll inf = 0x3fff3fff3fff3fff;
const ll N = 5e5+20;
vector<ll> out[N];
ll inc[N];
ll oup[N];
vector<ll> hd;
random_device rd;
mt19937_64 gen(rd());
ll cnt[N], cndiff=0;
inline void change(ll a, ll p){
    if(cnt[a]) cndiff--;
    cnt[a]+=p;
    if(cnt[a]) cndiff++;
}
inline void change2(ll v){
    change(out[v][oup[v]], -1);
    oup[v]++;
    change(out[v][oup[v]], 1);
}
inline void change3(ll v){
    change(out[v][oup[v]], -1);
    oup[v]=0;
    change(out[v][oup[v]], 1);
}
ll was[N], wc=0;
inline ll check2(ll v){
    ll done=0;
    while(was[v]!=wc){
        done++;
        was[v]=wc;
        v = out[v][oup[v]];
    }
    return done;
}
inline void out2(){
    ll v=0;
    while(was[v]!=wc){
        was[v]=wc;
        cout<<v+1<<' ';
        v = out[v][oup[v]];
    }
}
signed main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
    ll n, m;
    cin >> n>> m;
    for(ll i = 0;i<m;i++){
        ll a, b;
        cin >> a >> b;
        --a, b--;
        out[a].push_back(b);
        inc[b]++;
    }
    for(ll i = 0;i<n;i++){
        if(out[i].empty() || inc[i] == 0) return cout<<"NO", 0;
        if(out[i].size() > 1) hd.push_back(i);//, shuffle(out[i].begin(), out[i].end(), gen);
    }
    //shuffle(hd.begin(), hd.end(), gen);
    for(ll i = 0;i<n;i++){
        change(out[i][0], 1);
    }
    ll u = 0;
    do{
        if(cndiff == n){
            wc++;
            if(check2(0)==n){
                cout<<"YES\n";
                ++wc;
                out2();
                cout<<1;
                return 0;
            }
        }
        while(u < (ll)hd.size() && oup[hd[u]] == (ll)out[hd[u]].size()-1) ++u;
        if(u==(ll)hd.size()) break;
        change2(hd[u]);
        while(u>0){
            --u;
            change3(hd[u]);
        }
    }while(true);
    cout<<"NO\n";
}
