#include <bits/stdc++.h>

using namespace std;

#define DIM 1000037

int n, m, vis[DIM], mx[DIM], u, v, nxt[DIM], it;

vector<int> vec[DIM];

void dfs(int v){
    vis[v]=1;
    mx[v]=-1;
    nxt[v]=-1;
    for(auto to : vec[v]){
        if(to==1 && v!=1){
            mx[v]=max(mx[v], 1);
            nxt[v]=1;
        }
        if(vis[to]==1) continue;
        if(vis[to]==2){
            if(mx[to]!=-1 && mx[to]+1>mx[v]){
                mx[v]=mx[to]+1;
                nxt[v]=to;
            }
        }
        dfs(to);
        if(mx[to]!=-1 && mx[to]+1>mx[v]){
            mx[v]=mx[to]+1;
            nxt[v]=to;
        }
    }
    vis[v]=2;
    return;
}

int main(){
    scanf("%d%d", &n, &m);
    for(int i=1; i<=m; i++){
        scanf("%d%d", &u, &v);
        vec[u].push_back(v);
    }
    dfs(1);
    if(mx[1]!=n){
        printf("NO");
        return 0;
    }
    it=nxt[1];
    printf("YES\n");
    printf("1 ");
    while(it!=1){
        printf("%d ",  it);
        it=nxt[it];
    }
    printf("1");
    return 0;
}
