#include <bits/stdc++.h>

using namespace std;
vector<long long> g[100005];
long long s1[100005], s2[100005];
bool used[100005];
bool f= false;
long long cnt = 0;
vector<long long> ans;
vector<long long> c;
long long n,m;
bool used1[100005];
void dfs1(long long v)
{
    used1[v] = true;
    for(int i =0; i < g[v].size(); i ++)
    {
        long long to = g[v][i];
        if(used1[to]==false) dfs1(to);
    }
}
void dfs(long long v)
{
    used[v] = true;
    cnt ++;
    c.push_back(v);
    for(int i = 0; i < g[v].size(); i++){
        long long to = g[v][i];
        if(cnt == n && to == 0 && f == false)
        {
            for(int j = 0; j<c.size(); j++)
            {
                ans.push_back(c[j]);
            }
            f = true;
        } else if(used[to ] == false && f == false) dfs(to);
    }
    c.erase(c.end()-1);
    used[v] = false;
    cnt --;

}
int main()
{
   ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   cin>>n>>m;
   long long a ,b;
   for(int i = 0; i < m; i ++)
   {
       cin>>a>>b;
       a--;
       b--;
       g[a].push_back(b);
       s1[a]++;
       s2[b]++;
   }
   cout<<"NO";
   return 0;
   for(int i =0; i<n; i ++)
    if(s1[i] == 0 || s2[i] == 0)
   {
       cout<<"NO";
       return 0;
   }
   dfs1(0);
   for(int i=0; i < n; i ++)
    if(used1[i] == false)
   {
       cout<<"NO\n";
       return 0;
   }
   dfs(0);
   if(f == false)
    cout<<"NO\n";
   else {
    cout<<"YES\n";
    for(int i = 0; i < n; i ++)
        cout<<ans[i] + 1 <<' ';
    cout<<1;
   }
}
