#include <bits/stdc++.h>
#define fr(i,x,y) for(int i=x;i<y;i++)
#define rfr(i,x,y) for(int i=x;i>=y;i--)
//#define int long long

using namespace std;

const int N=1e6;
vector<int> gr[N];
int cnt_in[N];
bool used[N];
int cnt = 0;
int n,m;
vector<int> ans;
int t = 0;
mt19937 rnd(time(0));
int fast[N];
int cnt_fast[N];
vector<int> fast_v[N];
int first = -1;
void find(int v)
{
  if(v == 1)
  {
    fast[first]=v;
    return;
  }
  if(cnt_in[v] != 1 || gr[v].size() != 1)
  {
    fast[first]=v;
    return;
  }
  cnt_fast[first]++;
  fast_v[first].push_back(v);
  find(gr[v][0]);
}
bool dfs(int v)
{
  if(v == 1 && cnt >= n)
  {
    ans.push_back(v);
    return true;
  }
  if(used[v])
  {
    t++;
    return false;
  }
  if(t>=1e4)
    return false;

  if(v!=1 && fast[v] == 0 && gr[v].size() == 1 && cnt_in[v] == 1)
  {
    first=v;
    find(v);
  }

  used[v]=1;
  if(fast[v]!=0)
  {
    cnt += cnt_fast[v];
    if(dfs(fast[v]))
    {
      rfr(i,fast_v[v].size()-1,0)
      {
        ans.push_back(fast_v[v][i]);
      }
      return true;
    }
    cnt-=cnt_fast[v];
    used[v] = 0;
    return false;
  }

  cnt += 1;

  for(auto j:gr[v])
  {
    if(dfs(j))
    {
      ans.push_back(v);
      return true;
    }
  }
  used[v] = 0;
  cnt -= 1;
  return false;
}
void solve()
{
  cin>>n>>m;
  fr(i,0,m)
  {
    int a,b;
    cin>>a>>b;
    cnt_in[b]+=1;
    gr[a].push_back(b);
  }
  if(dfs(1))
  {
    cout<<"YES\n";
    reverse(ans.begin(),ans.end());
    for(auto j:ans)
    {
      cout << j << ' ';
    }
  }
  else
  {
    cout<<"NO\n";
  }
}

signed main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  int t=1;
  while(t--)solve();
}
