#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=1e5;
vector<int> gr[N];
bool used[N];
int cnt = 0;
int n,m;
vector<int> ans;
bool dfs(int v)
{
  if(v == 1 && cnt == n)
  {
    ans.push_back(v);
    return true;
  }
  if(used[v])
    return false;
  used[v]=1;
  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;
    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();
}
