#include<bits/stdc++.h>
#define int long long
#define zmrl(x) signed((x).size())
#define ahen(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii = pair<int,int>;

int root[300300];
vector<int> adj[300300];
list<int> Set[300300];
int pre[300300], post[300300];
vector<int> v;
int num;

int Find(int x) {
    return root[x] == x ? x : root[x] = Find(root[x]);
}

void dfs(int cur) {
    pre[cur] = ++num;
    for (auto &nxt : adj[cur]) {
        if (!pre[nxt]) dfs(nxt);
        else if (pre[nxt] < pre[cur] && !post[nxt]) {
            cout<<0<<'\n';
            exit(0);
        }
    }
    v.pb(cur);
    post[cur] = ++num;
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n,k; cin>>n>>k;
    int A[300300];
    for (int i=1; i<=n; i++) {
        cin>>A[i];
        root[i] = i;
        Set[i].pb(i);
    }
    for (int i=1; i<=k; i++) {
        int a,b; cin>>a>>b;
        int aa = Find(a), bb = Find(b);
        if (aa==bb || Set[aa].back() != a || Set[bb].front() != b) {
            cout<<0<<'\n';
            return 0;
        }
        root[bb] = aa;
        Set[aa].splice(Set[aa].end(), Set[bb]);
    }
    set<int> s;
    for (int i=1; i<=n; i++) {
        s.insert(Find(i));
    }
    int Idx[300300];
    for (auto &cur: s) {
        int idx = 0;
        for (auto &a : Set[cur]) {
            Idx[a] = ++idx;
        }
    }
    for (int i=1; i<=n; i++) {
        if (!A[i]) continue;
        int p = Find(A[i]), q = Find(i);
        if (p==q) {
            if (Idx[A[i]] > Idx[i]) {
                cout<<0<<'\n';
                return 0;
            }
        }
        else adj[p].pb(q);
    }
    for (int i=1; i<=n; i++) {
        int a = Find(i);
        if (!pre[a]) dfs(a);
    }
    reverse(ahen(v));
    for (auto &cur: v) {
        for (auto &a : Set[cur]) cout<<a<<' ';
    }
    cout<<'\n';
    return 0;
}