#include <bits/stdc++.h>

using namespace std;

int n, m;
vector<int> g[101010];
vector<int> stk;
int color[101010];
void dfs(int v) {
//    cout << v << " <<< " << endl;
    if (color[v] == 1) {
        if (stk.size() == n) {
            cout << "YES\n";
            for (auto i : stk)cout << i << " ";
            cout << 1;
            exit(0);
        }
        return;
    }
    stk.push_back(v);
    color[v] = 1;
    for (auto to : g[v]) {
        dfs(to);
    }
    color[v] = 0;
    stk.pop_back();
}

int main()
{
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int A, B;
        cin >> A >> B;
        g[A].push_back(B);
    }
    dfs(1);
    cout << "NO";
    return 0;
}
