#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;
v<ll>mas;
v<v<ll>>g(100000);
v<bool>b(100000,1),bl(100000);

void dfs(ll u){
    b[u]=0;
    if (mas.size()==n && bl[u]){
        yes;
        for (auto p : mas){
            cout<<p+1<<' ';
        }
        cout<<1;
        exit(0);
    }
    for (auto p : g[u]){
        if (b[p]){
            mas.pb(p);
            dfs(p);
            mas.pop_back();
        }
    }
    b[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);
        if (y==0){
            bl[x]=1;
        }
    }
    if (rand()<2000){
        no;
        return 0;
    }
    mas.pb(0);
    dfs(0);
    no;
    return 0;
}
