#include <bits/stdc++.h>
typedef long long ll;
#define endl '\n'
using namespace std;
const int N=2000100;
vector<int>g[N];
bool used[N];
vector<int>order;
void dfs(int v,int need){
    used[v]=true;
    order.push_back(v);
    for (int to:g[v]){
        if (to==1 && need==0){
            cout<<"YES\n";
            for (int i:order) cout<<i<<" ";
            cout<<1<<endl;
            exit(0);
        }
        if (!used[to]){
            dfs(to,need-1);
        }
    }

    order.pop_back();
    used[v]=false;
}
int in[N];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,m;cin>>n>>m;
    for (int i=1;i<=m;i++){
        int a,b;cin>>a>>b;
        g[a].push_back(b);
        in[b]++;
    }
    for (int i=1;i<=n;i++){
        if (g[i].empty() || in[i]==0){
            cout<<"NO\n";
            return 0;
        }
    }
    dfs(1,n-1);
    cout<<"NO\n";
    return 0;
}
