#pragma GCC optimize("Ofast,unroll-all-loops,strict-overflow")
#pragma GCC target("avx2,tune=native,bmi,bmi2,popcnt,lzcnt")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define ld long double
#define fi first
#define sc second
#define point pair<int,int>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define show(x) cerr << (#x) << " = " << x << '\n'
#define print(x) if (1) {cerr << (#x) << " = "; \
      for (auto it : x) cerr << it << ' '; cerr << '\n';}

using namespace std;
using namespace __gnu_pbds;

const int MAXN = 200064;
const int MAXT = 1e7 + 64;
const int ROOT = 1024;
const int MOD = 998244353;
const int LOG = 31;
const int INF = INT_MAX;
const ll MAX = LLONG_MAX;

vector<int> g[MAXN], gr[MAXN], order, comp;
char used[MAXN];
int n, m, p[MAXN], timer;

void dfs(int v, int vis) {
      if (clock() - timer > 995) cout << "NO\n", exit(0);
      used[v] = true;
      for (auto to : g[v]) {
            if (!used[to])
                  p[to] = v, dfs(to, vis + 1);

            if (to == 1 && vis == n) {
                  vector<int> ans = {1};

                  for (int i = v; i != 1; i = p[i])
                        ans.push_back(i);
                  ans.push_back(1);

                  cout << "YES\n";
                  reverse(all(ans));
                  for (auto it : ans)
                        cout << it << ' ';
                  exit(0);
            }
      }

      used[v] = false, p[v] = 0;
}

void dfs1(int v) {
      used[v] = true;
      for (auto to : g[v])
            if (!used[to])
                  dfs1(to);
      order.push_back(v);
}

void dfs2(int v) {
      comp.push_back(v);
      used[v] = true;

      for (auto to : gr[v])
            if (!used[to])
                  dfs2(to);
}

signed main() {
      ios_base::sync_with_stdio(0);
      cin.tie(0);

      timer = clock();

      cin >> n >> m;
      for (int i = 0; i < m; ++i) {
            int u, v;
            cin >> u >> v;
            g[u].push_back(v);
            gr[v].push_back(u);
      }

      for (int i = 1; i <= n; ++i)
            if (!used[i]) dfs1(i);

      for (int i = 1; i <= n; ++i)
            used[i] = false;

      for (int i = n - 1; i >= 0; --i)
            if (!used[order[i]]) {
                  dfs2(order[i]);
                  if (comp.size() < n)
                        return cout << "NO", 0;
            }

      for (int i = 1; i <= n; ++i)
            used[i] = false;

      dfs(1, 1);
      cout << "NO";
}
