#include <bits/stdc++.h>

using namespace std;

const int N = 1e5;
vector<int> g[N];
int n;

void dfs(const int i, unordered_set<int>& vis, vector<int>& vvis) {
    for (auto j : g[i]) {
        if (j == 0 && vis.size() == n) {
            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, vis, vvis);
            vis.erase(j);
            vvis.pop_back();
        }
    }
}

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);
    }
    unordered_set<int> vis;
    vis.insert(0);
    vector<int> vvis = {0};
    dfs(0, vis, vvis);
    cout << "NO\n";
    return 0;
}
