#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

int n,m;
vector<int> graph[100002];
vector<int> result;
bool used[100000];

bool dfs(int v, int p, set<int> s) {    //p - прямой предок
    s.insert(v);

    for (int u: graph[v]) {
        if (s.count(u)==0) {
            if(dfs(u, p+1,s)) 
            {
                result.push_back(v);
                return true;
            }
        } else if (u==1 && p == n) {
            //cout << "Graph has cycles.";
            result.push_back(v);
            return true;    
        }
    }
    return false;
}

int main(){
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        int v1,v2;
        cin>>v1>>v2;
        graph[v1].push_back(v2);
    }
    set<int> s;
    dfs(1,1,s);

reverse(result.begin(),result.end());
    if(result.size()==n){ 
        cout<<"YES"<<endl;
        for(int x : result) cout<<x<<" ";
        cout<<result.begin()<<endl;
    }
    else cout<<"NO"<<endl;
    return 0;
}

