#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")

using namespace std;

using ll = long long;
using ld = long double;

ll n, m, k, q, x, y, z, a, b, c, d;
string s;
vector<ll> G[100000];
ll nxt[100000];
ll mp[100000];
unordered_set<ll> used;
bitset<100000> st;
bool vis[100000];

bool check(ll x, vector<ll> &v) {
//    cout << x << endl;
//    for (int i = 0; i < x; i++) {
//        cout << v[i] << ' ';
//    }
//    cout << endl;
    if (x == n) {
        vector<ll> b(n);
        for (int i = 0; i < n; i++) {
            b[v[i]]++;
            if (b[v[i]] == 2) {
                return 0;
            }
        }
        cout << "YES\n";
        ll x = 0;
        cout << x + 1 << ' ';
        while (v[x] != 0) {
            x = v[x];
            cout << x + 1 << ' ';
        }
        cout << 1 << '\n';
        return 1;
    }
    for (int to : G[x]) {
        v.push_back(to);
        bool b = check(x + 1, v);
        v.pop_back();
        if (b == 1) {
            return 1;
        }
    }
    return 0;
}

void solve() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        nxt[i] = -1;
        mp[i] = -1;
    }
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
    }
    vector<ll> v;
    bool b = check(0, v);
    if (b == 0) {
        cout << "NO\n";
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << fixed;
    cout << setprecision(10);
    solve();
}
