// Ignut

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int MAXN = 1e5;
//bool used[MAXN];

void dfs(vector <vector <int>> v, int vert, vector <bool> &used) {
    //cout << vert << ' ';
    used[vert] = true;
    for (int i = 0; i < v[vert].size(); i ++) {
        if (!used[v[vert][i]])
            dfs(v, v[vert][i], used);
    }
    //cout << "\n";
}

class State {
    public:
        int inn;
        int out;
};

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, m;
    cin >> n >> m;
    vector <vector <int>> v = {};
    v.resize(n);
    vector <State> s = {};
    s.resize(n);

    int newm = m;

    for (int i = 0; i < m; i ++) {
        int p, q;
        cin >> p >> q; // p -> q
        p --; q --;
        
        if (p != q && !binary_search(v[p].begin(), v[p].end(), q)) {
            v[p].push_back(q);
            s[p].out ++;
            s[q].inn ++;
        }
        else
            newm --;
    }

    m = newm;
    if (m < n) {
        cout << "NO\n";
        return 0;
    }

    for (int i = 0; i < n; i ++)
        if (s[i].inn < 1 || s[i].out < 1) {
            cout << "NO\n";
            return 0;
        }
    /*
    for (int i = 0; i < n; i ++)
        cout << s[i].inn << ' ' << s[i].out << "\n";
    cout << "\n";
    */

    // <checking for one component
    vector <bool> used = {};
    used.resize(n);
    for (int i = 0; i < n; i ++)
        used[i] = false;

    dfs(v, 0, used);

    for (int i = 0; i < n; i ++) {
        if (!used[i]) {
            cout << "NO\n";
            return 0;
        }
    }
    // >

    for (int i = 0; i < n; i ++) {
        vector <int> to_del = {};
        for (int j = 0; j < v[i].size(); j ++) {
            int p = v[i][j];
            if (s[i].out > 1 && s[p].inn > 1) {
                to_del.push_back(j);
                s[i].out --;
                s[p].inn --;
            }
            if (s[i].out == 1)
                break;
        }

        for (int j = 0; j < to_del.size(); j ++) {
            v[i].erase(v[i].begin() + to_del[j] - j);
            m --;
        }
        if (m == n)
            break;
    }
    /*
    for (int i = 0; i < n; i ++) {
        cout << i << ": ";
        for (int j = 0; j < v[i].size(); j ++) {
            cout << v[i][j] << ' ';
        }
        cout << "\n";
    }*/

    cout << "YES\n";
    cout << 1 << ' ';
    int i = 0;
    while (v[i][0] + 1 != 1) {
        i = v[i][0];
        cout << i + 1 << ' ';
    }
    cout << 1 << "\n";
    return 0;   
}