#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h>
 
#ifndef ONLINE_JUDGE
    #define my_dbg
#endif
 
#define speed_up ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define open_files freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#define all(x) x.begin(), x.end()
 
typedef long long ll;
 
using namespace std;

vector<ll> col, path;
vector<vector<ll>> graph;
bool flag = false;
ll n, m;

void dfs(ll v, ll& cnt) {
    ++cnt;
    col[v] = 2;
    path.emplace_back(v);
    for (ll N : graph[v]) {
        if (N == 1 && cnt == n) {
            flag = true;
            return;
        }
        if (flag) return;
        if (col[N] < 2) dfs(N, cnt);
    }
    if (flag) return;
    col[v] = 0;
    --cnt;
    path.pop_back();
}

void solve() {
    cin >> n >> m;
    graph.resize(n + 1);
    col.resize(n + 1, 0);
    for (ll i = 0; i < m; ++i) {
        ll v, u;
        cin >> v >> u;
        graph[v].emplace_back(u);
    }
    for (ll i = 1; i <= n; ++i) {
        if (graph[i].size() == 0) {
            cout << "NO\n";
            return;
        }
    }
    ll cnt = 0;
    dfs(1, cnt);
    if (path.size() == n) {
        cout << "YES\n";
        for (ll i : path) cout << i << " ";
        cout << "1\n";
    }
    else {
        cout << "NO\n";
    }
}   
 
signed main() {
 
    speed_up
 
#ifdef my_dbg
    open_files
    clock_t processor_time = clock();
#endif
 
    signed t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
 
#ifdef my_dbg
    cout << "\nTIME : " << (clock() - processor_time) / (double)CLOCKS_PER_SEC;
#endif
 
}