#include <bits/stdc++.h>

using namespace std;

void dfs(int i, vector<vector<int>>& g, set<int>& vis, vector<int>& vvis) {

    for (auto j : g[i]) {
        if (j == 0 && vis.size() == g.size()) {
            cout << "YES\n";
            for (auto k : vvis) {
                cout << k + 1 << ' ';
            }
            cout << 1 << '\n';
            exit(0);
        }
        if (vis.find(j) == vis.end()) {
            vis.insert(j);
            vvis.push_back(j);
            dfs(j, g, vis, vvis);
            vis.erase(j);
            vvis.pop_back();
        }
    }
}

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