#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <iostream>
#include <vector>
#include <string>
#include <time.h>
#include <set>

#define pb push_back

using namespace std;
using ll = long long;
using ull = unsigned long long;
using dl = double;

const ll N = 210100;
const ll inf = 100000000000;

ifstream in("input.txt");
ofstream out("output.txt");

int n, m;
vector<int> p[N];

//vector<int> r (int v, vector<int> vs) {
//
//}

int main() {
    srand(time(0));

    in >> n >> m;

    for (int i = 0; i < m; ++i) {
        int a, b;
        in >> a >> b;
        p[a].pb(b);
    }

    for (int i = 0; i < 10; ++i) {

        vector<int> path;
        set<int> s;
        int v = 1;
        path.pb(1);
        for (int i = 0; i < n + 1; ++i) {
            v = p[v][rand() % p[v].size()];
            path.pb(v);
            if (s.count(v)) {
                continue;
            }
            s.insert(v);
        }
        if (v == 1) {
            out << "YES" << endl;
            for (int w : path) {
                out << w << " ";
            }
            out << endl;
            return 0;
        }
    }

    out << "NO" << endl;

    return 0;
}