#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

#define fast ios_base::sync_with_stdio();cin.tie();cout.tie();
#define ops cout<<"ops"<<endl;
#define en cout<<endl;
#define fi first
#define se second

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pllll;
typedef string str;
typedef char cr;

const ll DIM=1e5+7;
const ll DIMM=1e5+7;
const ll DDIM=1e7+7;
const ll INF=1e16+7;
const ll X=1e9;
const ll BS=37;
const ll MODULO=1e9+7;

ll n,m,k;

vector<ll> a[DIM],res;

ll vis[DIM],d[DIM],best_child[DIM];

void clear_vis(){
    for(int i=1;i<=n;i++)vis[i]=0;
}

void dfs(ll v){

    vis[v]=1;

    ll md=(-10);

    for(auto to:a[v]){

     if(to==1){
      d[v]=1;
      md=0;
      best_child[v]=1;
      continue;
     }

     if(vis[to]==0)dfs(to);

     if(d[to]>md){
      best_child[v]=to;
      md=d[to];
     }

    }

    d[v]=max(d[v],(md+1));

    vis[v]=2;
}

void dfs1(ll v){

    vis[v]=1;

    ll md=d[v]-1;

    for(auto to:a[v]){

     if(vis[to]==0)dfs(to);

     if(d[to]>md){
      best_child[v]=to;
      md=d[to];
     }

    }

    d[v]=max(d[v],(md+1));
}

void solve(){

    cin>>n>>m;

    ll v1,v2;

    for(int i=1;i<=m;i++){
     cin>>v1>>v2;
     a[v1].push_back(v2);
    }

    dfs(1);

    clear_vis();

    //dfs1(1);

    if(d[1]<n){
     cout<<"NO"<<endl;
     return;
    }

    cout<<"YES"<<endl;

    v1=1;
    while(1){
     res.push_back(v1);
     v1=best_child[v1];
     if(v1==1)break;
    }
    res.push_back(1);

    for(auto val:res)cout<<val<<' ';
    cout<<endl;

    return;
}

int main()
{

    fast;

    int nt;

    nt=1;

    //cin>>nt;

    while(nt--)
        solve();

    return 0;
}
