#include "bits/stdc++.h"
#define DIM 100027
#define mod 100000007
#define eps 0.000000001
#define pi 3.14
#define INF 100000000000001
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<long long, long long> pll;


ll t, n, vis[DIM], par[DIM], d[DIM], b, c, res, k, l, r, m, x, y;

vector <ll> a[DIM];

bool fl;

//char c;
/*struct aa{
    ll x, y, num;
} a[DIM];*/
//map <ll, ll> m;
//vector <ll> v;

string s, s1[DIM], s2;
priority_queue <ll, vector<ll>, greater<ll> > q;

void dfs(ll v, ll p){
    vis[v] = 1;
    par[v] = p;
    d[v] = d[p] + 1;
    if(fl) return;
   // cout << v << endl;
    for(int i = 0; i < a[v].size(); i ++){
        ll to = a[v][i];
        if(vis[to] != 1){
            dfs(to, v);
        }
        else if(to == 1 && d[v] == n){
            fl = true;
            x = v, k = 1;
            cout << "YES" << endl;
            vector <ll> res;
            res.push_back(to);
            while(x != 1){
                res.push_back(x);
                k ++;
                x = par[x];
            }
            cout << 1 << ' ';
            reverse(res.begin(), res.end());
            for(int i = 0; i < res.size(); i ++){
                cout << res[i] << ' ';
            }
            cout << endl;
            return;
        }
    }
    vis[v] = 2;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= m; i ++){
        cin >> x >> y;
        a[x].push_back(y);
    }
    d[1] = 1;
    dfs(1, 0);
    if(!fl) cout << "NO" << endl;
}
