#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pi 3.14159265358979323846
#define sqr(a) (a)*(a)
#define v vector
#define ll long long
#define ld long double
#define f first
#define sec second
#define pb push_back
#define pf push_front
#define umap unordered_map
#define sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define mod 1000000007
#define inf 2*1e18

using namespace std;
using namespace __gnu_pbds;

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>uset;

ll n,x,c,q;
v<ll>to(100000,-1);
v<v<ll>>g(100000),a(100000),mas(100000);
v<bool>check(100000,1),b(100000);

void dfs(ll u){
    if (u==n){
        for (ll i=0;i<n;i++){
            b[i]=1;
        }
        x=0;
        c=1;
        q=1;
        v<ll>res;
        while (c!=n){
            b[x]=0;
            res.pb(x+1);
            if (b[to[x]]==0){
                q=0;
                break;
            }
            x=to[x];
            c++;
        }
        if (q && to[x]==0 && b[x]){
            res.pb(x+1);
            res.pb(1);
            yes;
            for (auto p : res){
                cout<<p<<' ';
            } 
            exit(0);
        }
        return;
    }
    if (to[u]==-1){
        for (auto p : mas[u]){
            to[u]=p;
            dfs(u+1);
        }
    }else{
        dfs(u+1);
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(time(NULL));
    ll i,x,y,m;
    cin>>n>>m;
    for (i=0;i<m;i++){
        cin>>x>>y;
        x--;
        y--;
        g[x].pb(y);
        a[y].pb(x);
    }
    for (i=0;i<n;i++){
        if (g[i].size()==1){
            to[i]=g[i][0];
            check[g[i][0]]=0;
        }
        if (a[i].size()==1){
            to[a[i][0]]=i;
            check[i]=0;
        }
    }
    for (i=0;i<n;i++){
        if (to[i]==-1){
            for (auto p : g[i]){
                if (check[p]){
                    mas[i].pb(p);
                }
            }
        }
    }
    dfs(0);
    no;
    return 0;
}
