#include <bits/stdc++.h>
using namespace std;

string FindAnswer(int N, int w[5000][5000], int s, int f, string str){
    string answ;
    for (int i = 0; i < N; i++){
        w[0][f] = 0;
    }
    if (w[f][0] == 1){
        if (s == N){
            str += " 1";
            return str;
        }
    }
    else{
        for (int i = 1; i < N; i++){
            if (w[f][i] == 1){
                answ = FindAnswer(N, w, (s + 1), i, (str + " " + to_string((i + 1))));
                if (answ != "-1") break;
            }
            else if (w[0][i] == -1) break;
        }
    }
    return answ;
}

int main(){
    int n, m;
    cin >> n >> m;
    int a[m], b[m];
    for (int i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
    int w[5000][5000];
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            w[i][j] = 0;
        }
        for (int j = n; j < 5000; j++){
            w[i][j] = -1;
        }
    }
    for (int i = n; i < 5000; i++){
        for (int j = 0; j < 5000; j++){
            w[i][j] = -1;
        }
    }
    for (int i = 0; i < m; i++){
        w[a[i]][b[i]] = 1;
    }
    string ans = "-1";
    for (int i = 1; i < n; i++){
        if (w[0][i] == 1){
            ans = FindAnswer(n, w, 2, i, ("1 " + to_string((i + 1))));
        }
        else if (w[0][i] == -1) break;
    }
    if (ans == "-1") cout << "NO" << endl;
    else{
        cout << "YES" << endl;
        cout << ans << endl;
    }
}
