#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using vi = vector<int>;
using pii = pair<ll, ll>;
using vvi = vector<vi>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vb = vector<bool>;

vector<int>result;
bool dfs(int n, vvi& g, vb used, int st, int v, int start){
    if(v!=start)used[v] = 1;
    for(auto to : g[v]) {
       if(!used[to]) {
           if(to == start && st==n) {
               result.push_back(1);
               result.push_back(v);
               return 1;
           }
           if(dfs(n, g, used, st+1, to, start)){
               result.push_back(v);
               return 1;
           }
       }
    }
    return 0;
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	int n, m;
    cin>>n>>m;
    vvi g(n+1);
    for(int i=0; i<m; i++){
        int a, b;
        cin>>a>>b;
        g[a].push_back(b);
    }
    bool f = 0;
    /*for(int i=1; i<=n; i++){
        vb used(n+1, 0);
        vi way;
        dfs(n, g, used, way, i, i);
    }*/

    vb used(n+1, 0);
    vi way(0,0);
    if(dfs(n, g, used, 1, 1, 1)){
        cout<<"YES\n";
        reverse(result.begin(), result.end());
        for(auto i : result) cout<<i<<' ';
    }
    else cout<<"NO";
}
