#include<bits/stdc++.h>
//#define int long long
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define m_p make_pair
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC target("avx,avx2")
using namespace std;
vector<int>in[100001];
vector<int>out[100001];
vector<int>pereb;
int pred[100001];
int nxt[100001];
int step[100001];
int cnt[100001];
int s=0, t=0; //s->t
int n;
int used[100001];
bitset<100001>used1;
bool perev(int x)
{
    used1&=0;
    used1[0]=1;
    int cnt=0;
    vector<int>g;
    while(!used1[x])
    {
        used1[x]=1;
        g.pb(x);
        cnt++;
        x=nxt[x];
    }
    bool fl=0;
    for(auto i:out[g[g.size()-1]])
    {
        if(i==1)
            fl=1;
    }
    for(int i=1; i<=n; i++)
    {
        if(used1[i]==0)
            return false;
    }
    return fl;
}
bool f=0;
void dfs(int x)
{
    used[x]=1;
    cnt[x]=0;
    for(auto i:out[x])
    {
        if(!used[i])
        {
            dfs(i);
        }
        if(used[i]==2 && cnt[i]>cnt[x])
        {
            nxt[x]=i;
            cnt[x]=cnt[i]+1;
        }
    }
    used[x]=2;
    cnt[x]++;
}
void rec(int pos)
{
    if(f)
    {
        return;
    }
    if(pos==pereb.size())
    {
        if(perev(1))
        {
            f=1;
        }
        return;
    }
    int v = pereb[pos];
    for(int j=0; j<out[v].size(); j++)
    {
        nxt[v]=out[v][j];
        rec(pos+1);
        if(f)
        {
            return;
        }
    }
}
void solve()
{
    int m;
    cin>>n>>m;
    if(m<n)
    {
        cout<<"NO";
        return;
    }
    for(int i=0; i<m; i++)
    {
        int a, b;
        cin>>a>>b;
        out[a].pb(b);
        in[b].pb(a);
    }
    for(int i=1; i<=n; i++)
    {
        if(out[i].size()==0 || in[i].size()==0)
        {
            cout<<"NO";
            return;
        }
        if(in[i].size()==1)
        {
            pred[i]=in[i][0];
            nxt[pred[i]]=i;
        }
        if(out[i].size()==1)
        {
            nxt[i]=out[i][0];
            pred[nxt[i]]=i;
        }
        if(out[i].size()>1)
        {
            pereb.pb(i);
        }
    }
    dfs(1);
    if(!perev(1))
    {
        rec(0);
        if(!f)
        {
            cout<<"NO";
            return;
        }
    }
    cout<<"YES\n";
    int i=nxt[1];
    cout<<"1 ";
    while(i!=1 && i>0)
    {
        cout<<i<<" ";
        i=nxt[i];
    }
    cout<<1;
}
main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int t=1;
//    cin>>t;
    while(t)
    {
        t--;
        solve();
    }
}
//5 6
//1 2
//2 3
//3 4
//4 5
//3 1
//5 2
//YES
//1 2 3 4 5 1
