#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void dfs(int n, vector<vector<int>> &graph, vector<int> &c, vector<int> &ans, int s){
    c[n]=1;
    s++;
    for (int i=0; i<graph[n].size(); i++){
        int v=graph[n][i];
        if (v==0 && c.size()==s){
            c[n]=2;
            ans.push_back(n+1);
        }
        else if (c[v]==0){
            dfs(v, graph, c, ans, s);
            if (c[v]==2){
                c[n]=2;
                ans.push_back(n+1);
            }
        }
    }
    if (c[n]==1){
        c[n]=0;
    }
}

int main(){
    int n,m,a,b;
    cin>>n>>m;
    vector<vector<int>> graph(n, vector<int> {});
    for (int i=0; i<m; i++){
        cin>>a>>b;
        a--;
        b--;
        graph[a].push_back(b);
    }
    vector<int> c(n, 0);
    vector<int> ans={};
    dfs(0, graph, c, ans, 0);
    if (ans.size()>0){
        cout<<"YES"<<endl;
        reverse(ans.begin(), ans.end());
        ans.push_back(1);
        for (int i=0; i<ans.size(); i++){
            cout<<ans[i]<<" ";
        }
    }
    else{
        cout<<"NO";
    }
}