
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector <ll> w;
map <ll, ll> mm;
vector <ll> o = {};
ll n;
vector <vector <ll>> v = {};
ll ans = 0;   
void DFS()
{   
    if (ans == 0)
    {
        ll len = w.size();
        ll last = w[len - 1];
        for (ll i = 0; i < v[last].size(); i++)
        {
            if (mm[v[last][i]] == 0) {w.push_back(v[last][i]); mm [v[last][i]] = 1; DFS(); w.pop_back(); mm [v[last][i]] = 0;}
            else if (len == n) { ans = 1; o = w;}
        }
    }
}
int main()
{
    ll m;
    cin >> n >> m;
    for (ll i = 0; i < n; i++)
    {
        v.push_back({});
    }
    for (ll i = 0; i < m; i++)
    {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        v[a].push_back(b);
    }
        mm.clear();
        mm[0] = 1;
        w = {0};
        DFS();
        if (ans == 0) {cout <<"NO";}   
        else{
            cout << "YES\n";
    for (ll i= 0; i < o.size(); i++)
    {
        cout << o[i] + 1 << " ";
    }
    cout << o[0] + 1;
        }
}
