#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target ("avx2")
#include <bits/stdc++.h>

using namespace std;

const int N = 1e5;
vector<int> g[N];
int n;
int cnt = 0;
int vvis[N + 2];
int ind_vvis = 1;
unordered_set<int> vis;

void dfs(const int i) {
    if (cnt > 5e6) {
        cout << "NO\n";
        exit(0);
    }
    for (auto j : g[i]) {
        ++cnt;
        if (j == 0 && vis.size() == n) {
            cout << "YES\n";
            for (int k = 0; k < ind_vvis; ++k) {
                cout << vvis[k] + 1 << ' ';
            }
            cout << 1 << '\n';
            exit(0);
        }
        if (vis.find(j) == vis.end()) {
            vis.insert(j);
            vvis[ind_vvis] = j;
            ++ind_vvis;
            dfs(j);
            vis.erase(j);
            --ind_vvis;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int m;
    cin >> n >> m;
    while (m--) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        g[u].push_back(v);
    }
    vis.reserve(n);
    vis.insert(0);
    vvis[0] = 0;
    dfs(0);
    cout << "NO\n";
    return 0;
}
