#include<bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
long long n,m,i,j,k,l,q,r,h,a[1000009],ans,cnt1,cnt2,to;
vector < vector <long long> > g(1000009);
long long c[1000009];
long long p[1000009];
set <long long> st;
vector <long long> path;
bool dfs (long long v)
{
    c[v]=1;
    for(i=0; i<g[v].size(); i++)
    {
        to=g[v][i];
        if (c[to]==0)
        {
            p[to]=v;
            if (dfs(to)==1)
            {
                return 1;
            }
        }
        else
        {
            if (c[to]==1)
            {
                cnt2=v;
                cnt1=to;
                return 1;
            }
        }
    }
    c[v]=2;
    return 0;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for(i=1; i<=m; i++)
    {
        cin >> l >> r;
        g[l-1].push_back(r-1);
    }
    for(i=0; i<=n; i++)
    {
        p[i]=-1;
    }
    for(i=0; i<=n; i++)
    {
        c[i]=0;
    }
    cnt1=-1;
    for(i=0; i<n; i++)
    {
        if (dfs(i)==1)
        {
            break;
        }
    }
    if (cnt1==-1)
    {
        return cout << "NO\n",0;
    }
    path.push_back(cnt1);
    for(long long v=cnt2; v!=cnt1; v=p[v])
    {
        path.push_back(v);
    }
    path.push_back(cnt1);
    reverse(path.begin(),path.end());
    for(i=0; i<path.size(); i++)
    {
        st.insert(path[i]);
    }
    if (st.size()==n)
    {
        cout << "YES\n";
        for(i=0; i<path.size(); i++)
        {
            cout << path[i]+1 << " ";
        }
    }
    else
    {
        cout << "NO\n";
    }


}
