#include <bits/stdc++.h>
using namespace std;

int n, t;
vector <int> g[105000];
bool vis[105000];
map <int, int> way;
vector <int> get_way;
bool findd = 0;

void dfs(int v, int cnt) {
    if (findd)
        return;
    vis[v] = 1;
    for (auto i : g[v]) {
        if (!vis[i])
            way[i] = v, dfs(i, cnt + 1);
        else
        if (i == 1 && cnt == n) {
            t = v;
            findd = 1;
            return;
        }
    }
    vis[v] = 0;
}

void get(int v) {
    get_way.push_back(v);
    if (v != 1)
        get(way[v]);
}

int main() {
    int m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        g[a].push_back(b);
    }
    dfs(1, 1);
    if (!findd) {
        cout << "NO";
        return 0;
    }
    cout << "YES\n";
    get(t);
    for (int i = get_way.size() - 1; i > -1; i--)
        printf("%d ", get_way[i]);
    cout << 1;
    return 0;
}
