#include <iostream>
#include <bits/stdc++.h>

// #define int long long
#define endl '\n'
//#define inf 2000000000000000000
#define random (rand()^(rand()<<15))

using namespace std;
//constexpr int mod=1000000007;
//constexpr int MOD=998244353;
bitset<100010>used;
vector<vector<int>>g;
int n;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int m;
    cin>>n>>m;
    g.resize(n);
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        x--;y--;
        g[x].push_back(y);
    }
    stack<pair<int,int>>dfs;
    vector<int>st;
    dfs.push({0,0});
    while(!dfs.empty())
    {
        pair<int,int>q=dfs.top();
        int v=q.first,gl=q.second;
        dfs.pop();
        if(lower_bound(st.begin(),st.end(),v+1)==upper_bound(st.begin(),st.end(),v+1))
        {
            st.push_back(v+1);
        }
        used[v]=1;
        for(int&i:g[v])
        {
            if(!i&&gl+1==n)
            {
                cout<<"YES"<<endl;
                for(int j:st)
                {
                    cout<<j<<" ";
                }
                cout<<*st.begin()<<endl;
                return 0;
            }
            if(!used[i])
            {
                dfs.push({i,gl+1});
            }
        }
//        used[v]=2;
    }
    cout<<"NO"<<endl;
}
