#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];
char used[MAXN];
int n, m, p[MAXN];

void dfs(int v, int vis) {
      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;
}

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

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

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