#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <iomanip>
#include <set>
#include <cmath>
#include <stack>

#define LF '\n'

using namespace std;
typedef long long int lli;

vector<vector<int>> g;
vector<int> used;
int n, m,x=0;
stack<int> st;

void printans()
{
    vector<int> ans;
    ans.push_back(1);
    while (!st.empty()) {
        ans.push_back(st.top());
        st.pop();
    }
    reverse(ans.begin(), ans.end());
    for (auto i : ans) {
        cout << i << " ";
    }
}

void dfs(int a, int cnt)
{
    if (used[a] == 0)cnt++;
    if (cnt == n && a == 1) {
        cout << "YES" << LF;
        printans();
        x = 1;
        return;
    }

    if (used[a] == 1 || x==1) return;
    used[a] = 1;
    st.push(a);
    for (auto i : g[a]) {
        if (x == 1)return;
        dfs(i, cnt);
    }
    if (x == 1)return;
    used[a] = 0;
    st.pop();
}

void solve()
{
    cin >> n >> m;
    g.resize(n + 1);
    used.resize(n + 1);
    for (int i = 1; i <= m; i++) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
    }
    dfs(1, 0);
    if (x == 0) cout << "NO";
}

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

#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    solve();
}

