#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
// #define int long long
#define ft first
#define sc second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define GG cout << " OPA " << '\n';

using namespace std;

const int N = 3e5 + 5;
const int INF = 1e9;

vector <pair <int, int> > g[N];
vector <int> p;
bool ex[N];
int cnt[N];
int n;

void dfs(int v) {
    p.pb(v);
    ex[v] = 1;
    for (auto it : g[v]) {
        int to = it.ft;
        if (to == 1 && p.size() == n) {
            cout << "YES\n";
            for (auto it : p) {
                cout << it << ' ';
            }
            cout << 1;
            exit(0);
        }
        if (!ex[to] && cnt[it.sc] < 100) cnt[it.sc] ++, dfs(to);
    }
    ex[v] = 0;
    p.pop_back();
}

void solve() {
    int m;
    cin >> n >> m;
    for (int i = 1; i <= m; i ++) {
        int x, y;
        cin >> x >> y;
        g[x].pb({y, i});
    }
    for (int i = 1; i <= n; i ++) {
        reverse(all(g[i]));
    }
    dfs(1);
    cout << "NO\n";
}

main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0);
    int test = 1;
    // cin >> test;
    while(test --) {
        solve();
    }
}