#include <bits/stdc++.h>
using namespace std;
/*/void go(long long k,long long cnt,vector<long long>v[n]){
    for(int i=0;i<v[k].size();i++){
        if(st.find(i)!=st.end()){
            st.clear();
            cnt=0;
            break;
        }
        cnt++;
        st.insert(k);
        cout<<cnt<<" ";
        go(v[k][i]);
    }
    
}/*/
int main(){
    long long n,m;
    cin>>n>>m;
    vector<long long>v[n];
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
    }
    cout<<"YES"<<endl;
    for(int i=1;i<=n;i++){
        cout<<i<<" ";
    }
    cout<<1;
    /*/
    set<int>st;
    long long cnt=0;
    long long k=1;
    go(k,cnt,v[n]);/*/
}
