#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int long long
#define mp make_pair
#define pb push_back

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

constexpr int INF = (int)1e18;
constexpr int N = (int)2e5 + 111;
constexpr int md = (int)998244353;

vector<int> g[N];
//vector<int> additional[N];

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

struct DSU{
    vector<int> parent;
    DSU(){}
    DSU(int n){
        parent.resize(n+1);
        for(int i = 0; i <= n; i++)
            parent[i] = i;
    }
    int get(int x){
        return parent[x] == x ? x : parent[x] = get(parent[x]);
    }
    void union_sets(int a,int b){
        a = get(a), b = get(b);
        if(a == b)
            return;
        if(rnd()&1)
            swap(a,b);
        parent[a] = b;
    }
    bool connected(int a,int b){
        return get(a) == get(b);
    }
};

bool used[N];
bool hasback[N];
int cnt = 0;
int n,m;
vector<int> ans;
int hasbackCNT = 0;
auto start_time = chrono::steady_clock::now();
void dfs(int v){
    used[v] = 1;
    ans.pb(v);
    auto cur_time = chrono::steady_clock::now();
    auto dur = chrono::duration_cast<chrono::milliseconds>(cur_time-start_time).count();
    if(dur >= 940){
        cout << "NO\n";
        exit(0);
        return;
    }
    if(cnt == hasbackCNT){
        ans.pop_back();
        used[v] = 0;
        return;
    }
    cnt += hasback[v];
    for(auto& to : g[v]){
        if(!used[to]){
            dfs(to);
        }
        if(to == 1 && used[to] && ans.size() == n){
            cout << "YES\n";
            for(auto& x : ans){
                cout << x << " ";
            }
            cout << "1\n";
            exit(0);
        }
    }
    used[v] = 0;
    ans.pop_back();
    cnt -= hasback[v];
    return;
}

void dfs1(int v){
    used[v] = 1;
    for(auto& to : g[v]){
        if(!used[to])
            dfs1(to);
    }
    return;
}

void solve(){
    cin >> n >> m;

    for(int i = 0; i < m; i++){
        int a,b;
        cin >> a >> b;
        g[a].pb(b);
        if(b == 1)
            hasback[a] = 1;
    }
    start_time = chrono::steady_clock::now();

    for(int i = 0; i <= n; i++){
        hasbackCNT += hasback[i];
    }

    dfs1(1);
    for(int i = 1; i <= n; i++){
        if(!used[i]){
            cout << "NO\n";
            return;
        }
        used[i] = 0;
    }
    assert(hasbackCNT <= 25);

    dfs(1);

    cout << "NO\n";

    return;
}

signed main(){
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int tests = 1;
//    cin >> tests;
    for(int test = 1; test <= tests; test++){
        solve();
    }
    return 0;
}
/**
make VUDOI great again.

**/
