#include <bits/stdc++.h>
//author: @van4o_0
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef long double ld;

typedef pair<int, int> p_ii;
typedef pair<int, ll> p_il;
typedef pair <ll, ll> p_ll;

typedef map<int, int> dict_ii;
typedef map<int, vector<int>> dict_ivi;
typedef map <ll, ll> dict_ll;
typedef map<int, string> dict_is;

typedef vector<int> vi;
typedef vector <vi> vvi;
typedef vector <ll> vl;
typedef vector <vl> vvl;
typedef vector<bool> vb;
typedef vector <vb> vvb;
typedef vector<char> vc;
typedef vector <vc> vvc;

//define all(x) (x).begin(), (x).end()
//define sort(x) sort(all(x))

template<typename T>
istream &operator>>(istream &input, vector <T> &arr) {
    for (auto &e: arr) input >> e;
    return input;
}

template<typename T>
//print vector, default sep=" "
ostream &operator<<(ostream &print, vector <T> &arr_out) {
    string sep = " ";
    for (auto x: arr_out) print << x << sep;
    return print;
}

//define r(i, a, b) for (int i = a; i < (b); ++i)
//define range(i, b) for (int i = 0; i < (b); ++i)


vi dfs(dict_ivi &d, vi &a, int n){
    if(a.size() == n && a[a.size()-1] == 1) return a;

    for(int x: d[a[a.size()-1]]){
        a.push_back(x);
        if(a.size() <= n) a = dfs(d, a, n);
        if(a.size() == n && a[a.size()-1] == 1) return a;
        else if(a.size() == n){
            a.pop_back();
            return a;
        }
        a.pop_back();
    }
    return a;
}



void solve() {
    int n, m;cin >> n >> m;

    dict_ivi main;
    for(int i = 0;i<m;i++){
        int a, b;cin >> a >> b;
        main[a].push_back(b);
    }
    vi mas;
    mas.push_back(1);
    vi rez = dfs(main, mas, n+1);
    if(rez.size() == n+1 && rez[rez.size()-1] == 1) {
        cout << "YES\n" << rez << endl;
    } else{
        cout << "NO" << endl;
    }
}


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

    int tt = 1;
    // cin>>tt;
    while (tt--) solve();
    return 0;
}