#pragma GCC Optimize("O3")
#include "bits/stdc++.h"

using namespace std;

typedef int ll;
typedef pair<ll,ll>pairll;
typedef long double ld;

#define pb push_back
#define fr first
#define sc second
#define INF 1000000000000000007
#define MOD 1000000007
#define endl '\n'

ll n,m,f[100007],sz,d[100007],fl[100007];

vector<ll>v[100007],vr[100007];

stack<ll>res;

priority_queue<pairll,vector<pairll>, greater<pairll> >q;

ll S(ll x){
    f[x]=1;
    //cout<<sz<<" "<<d[x]<<" "<<x<<endl;
    if(sz+d[x]+1<n)return 0;
    sz++;
    for(int i=0;i<v[x].size();i++){
        if(f[v[x][i]]==1){
            if(v[x][i]==1 && sz==n){
                res.push(1);
                res.push(x);
                return 1;
            }
        }else{
            ll r=S(v[x][i]);
            if(r==1){
                res.push(x);
                return 1;
            }
        }
    }
    f[x]=0;
    sz--;
    return 0;
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cin>>n>>m;
    scanf("%d %d", &n, &m);
    for(int i=1;i<=m;i++){
        ll x,y;
        //cin>>x>>y;
        scanf("%d %d", &x, &y);
        v[x].pb(y);
        vr[y].pb(x);
    }
    q.push({1,1});
    while(q.size()>0){
        ll m1=q.top().fr;
        ll m2=q.top().sc;
        q.pop();
        //cout<<m1<<" "<<m2<<endl;
        if(d[m2]<=m1 && fl[m2]==0){
            d[m2]=m1;
            fl[m2]=1;
            for(int i=0;i<vr[m2].size();i++){
                if(d[vr[m2][i]]<m1+1 && vr[m2][i]!=1){
                    d[vr[m2][i]]=m1+1;
                    
                    q.push({m1+1,vr[m2][i]});
                }
            }
        }
    }
    
    d[1]=n;
    ll r=S(1);
    if(r==0){
        //cout<<"NO"<<endl;
        printf("NO\n");
        return 0;
    }
    //cout<<"YES"<<endl;
    printf("YES\n");
    while(res.size()>0){
        //cout<<res.top()<<" ";
        printf("%d", res.top());
        printf(" ");
        res.pop();
    }
    //cout<<endl;
    printf("\n");
    
    return 0;

}
