#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#define int long long
#define ll long long
#define ff first
#define ss second
#define num ss
#define value ff.ff
#define cntt ff.ss
#define pb push_back
#define m_p make_pair
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC target("avx,avx2")
using namespace std;
using namespace __gnu_pbds;
#define ordered set tree < int ,  null_type ,  less ,  rb_tree_tag ,  tree_order_statistics_node_update >
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//constexpr int N=2147483647;
//constexpr int INF=2147483647;
//constexpr int BIGINF=1e18;
//constexpr int N=500001;
//constexpr int mod=998244353;
vector<int>v[100001];
int color[100001];
bool used[100001];
int h[100001];
int H=1;
int pred[100001];
int n;
void dfs1(int x)
{
    used[x]=1;
    h[x]=H;
    H++;
    for(auto i:v[x])
    {
        if(!used[i])
        {
            dfs1(i);
        }
    }
    H--;
}
bool f=0;
vector<int>ans;
int a1=0, b1=0;
void dfs(int x)
{
    if(f)
    {
        return;
    }
    for(auto i:v[x])
    {
        if(h[i]<h[x])
        {
            int j=x;
            int cnt=1;
            while(j!=i)
            {
                cnt++;
                j=pred[j];
            }
            if(cnt==n)
            {
                j=x;
                while(j!=i)
                {
                    ans.pb(j);
                    j=pred[j];
                }
               ans.pb(i);
               f=1;
               return;
            }
        }
        if(h[i]>=h[x])
        {
            pred[i]=x;
            dfs(i);
        }
    }
    if(f)
        return;
}
void solve()
{
    int m;
    cin>>n>>m;
    if(m<n)
    {
        cout<<"NO";
        return;
    }
    for(int i=0; i<m; i++)
    {
        int a, b;
        cin>>a>>b;
        v[a].pb(b);
    }
    dfs1(1);
    dfs(1);
    if(f==0)
    {
        cout<<"NO";
        return;
    }
    cout<<"YES\n";
    int dd=ans.size();
    for(int i=0; i<dd; i++)
    {
        ans.pb(ans[i]);
    }
    for(int i=0; i<ans.size(); i++)
    {
        if(ans[i]==1)
        {
            for(int j=i+n; j>=i; j--)
            {
                cout<<ans[j]<<" ";
            }
            return;
        }
    }
}
main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int t=1;
//    cin>>t;
    while(t)
    {
        t--;
        solve();
    }
}
//5 8
//1 2
//1 3
//1 5
//2 3
//3 4
//4 1
//5 3
//5 2

