#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <map>

#define pii pair<int, int>
#define S second
#define F first
#define pb push_back

using namespace std;

typedef long long ll;

const int MAXN = 100005;
int used[MAXN];
vector <vector <int>> d(MAXN), d1(MAXN);
ll n, m;
vector <int> rez;
vector <int> KK(MAXN);

bool dfs(int v, int k){
  if ((v == 0) && (k == n-1)) {
    rez.push_back(0);
    return true;
  }
  if (used[v] == true) {return false;}
  used[v] = true;
  k += KK[v];
  for (int i = 0; i < d[v].size(); i++){
    if (dfs(d[v][i], k)) {
      rez.push_back(v);
      return true;
    }
  }
  used[v] = false;
  return false;
}

void solve (){
  cin >> n >> m;
  vector <int> IF(n);
  for (int i = 0; i < n; i++){
    used[i] = false;
    d[i].clear();
    d1[i].clear();
    IF[i] = 0;
    KK[i] = 1;
  }

  ll x, y;
  for (int i = 0; i < m; i++){
    scanf("%lld%lld", &x, &y);
    //cin >> x >> y;
    d[x-1].push_back(y-1);
    d1[x-1].push_back(y-1);
    IF[y-1] = 1;
  }


  for (int i = 0; i < n; i++){
    if (d[i].size() == 0 || IF[i] == 0) {printf("NO\n"); return;}
  }

  vector <int> VV(n);
  ll u = n;
  for (int i = 0; i < n; i++){
    if (d[i].size() == 1) {
      ll R = i;
      //KK[i]--;
      R = d[R][0];
      while (d[R].size() == 1 && R != i) {R = d[R][0]; KK[i]++;}
      d[i][0] = R;
      //VV[i] = d[i][0];
    }
  }

  for (size_t i = 0; i < d[0].size(); i++){
    if (dfs(d[0][i], 0)) {
      printf("YES\n");
      //cout << "YES\n"; 
      //cout << "1 ";
      rez.push_back(0);
      for (int j = rez.size()-1; j > 0; j--) {
        printf("%lld ", rez[j]+1);
        
        if (d1[rez[j]].size() == 1) {
          //printf("G");
          if (d1[rez[j]][0] != rez[j-1]) {
            
            ll R = d1[rez[j]][0];
            //printf("%lld ", R+1);
            while (d1[R].size() == 1 && R != rez[j-1]) {
              printf("%lld ", R+1);
              R = d1[R][0];
            }
          }
        }
      
      }
      printf("1");
      return;
    }    
  }
  
  printf("NO\n");
  return;
}

int main(){
  solve();

  return 0;
}
