#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define st string
#define pb push_back
#define rt return
#define rv reverse
#define sr sort
#define si size()
#define en end()
#define be begin()
#define sc second
#define fr first
#define vl vector < ll >
#define vvl vector < vector < ll > >
#define vs vector < st >
#define vvs vector < vector < st > >
#define pall pair < ll , ll >
#define pasl pair < st , ll >
#define pals pair < ll , st >
using namespace std;
vvl v(100005);
ll a[100005];
ll pr[100005]{0};
ll n,m,lk=0;
vl vr;
void dfspr(ll x)
{
 cout << x << " ";
  if (pr[x]==2)
   return;
  for (int i=0;i<v[x].si;++i)
    if (pr[v[x][i]]==pr[x]-1)
     dfspr(v[x][i]);
}
ll dfs(ll x)
{

 if (pr[x]==0)
 {
        a[x]=1;
         for (int i=0;i<v[x].si;++i)
         {
             if (a[v[x][i]]!=1)
             {
               pr[x]=max(dfs(v[x][i]),pr[x]);
             }else
             {
               if (v[x][i]==1)
                pr[x]=max(pr[x],(ll)1);
             }
         }
         a[x]=0;
         ++pr[x];
 }
    return pr[x];
}
int main()
{
fast;
    cin >> n >> m;
    for (int i=0;i<m;++i)
    {
        ll a,b;
        cin >> a >> b;
        v[a].pb(b);
    }
  ll xr=dfs(1);
    if (xr =! n)
    cout << "NO\n";
    else
    {
        cout << "YES\n";
        dfspr(1);
        cout << 1 << "\n";
    }

}
