#include <bits/stdc++.h>

using namespace std;

typedef double         db;
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;

#define N 300005
int n,m,x,y,fa[N],q[N],pre[N],pd[N],suc[N],root,flag,timestamp;
vi a1[N];
unordered_set<int> need_links[N];

int find(int x) {
    if (q[x]==x) return x;
    q[x]=find(q[x]);
    return q[x];
}

int main() {
    timestamp = 1;
   // freopen("input.txt", "r", stdin);
    scanf("%d %d",&n,&m);
    for(int i=1; i<=n; i++) {
        scanf("%d",&fa[i]);
        if (fa[i])
            a1[fa[i]].push_back(i);
        else root=i;
    }
    for(int i=1; i<=n; i++) q[i]=i;
    flag=1;
    for(int i=1; i<=m; i++) {
        scanf("%d %d",&x,&y);
        if (suc[x] || pre[y]) flag=0;
        pre[y]=x; suc[x]=y;
        q[find(y)] = find(x);
        pd[y]=1; pd[x]=1;
    }
    for(int i=1; i<=n; i++) {
        find(i);
        if (pd[i] && q[i]==i) {
            timestamp++;
            for(int j=i; j; j=suc[j]) {
                if (pd[j] == timestamp) {flag=0; break;}
                if (pd[fa[j]]!=timestamp) need_links[i].insert(j);
                pd[j]=timestamp;
            }
        }
    }
    
    vi ans;
    set<int> Q;
    if (pd[root] && need_links[q[root]].size()>1) flag=0;

    if (!flag) {printf("0\n"); return 0;}

    Q.insert(root);
    while (!Q.empty()) {
        x = *Q.begin();
        Q.erase(x);
        if (!pd[x]) {
            ans.push_back(x);
            for(int i: a1[x]) 
                if (!pd[i]) Q.insert(i);
                else {
                    need_links[q[i]].erase(i);
                    if (need_links[q[i]].empty()) Q.insert(q[i]);
                }
        } else {
            for(int i=x; i; i=suc[i]) {
                ans.push_back(i);
                for(int j: a1[i])
                    if (!pd[j]) Q.insert(j);
                    else if (q[j]!=x){
                        need_links[q[j]].erase(j);
                        if (need_links[q[j]].empty()) Q.insert(q[j]);
                    }
            }
        }
    }
    
    if (ans.size() < n) printf("0\n"); else {
        for(int i: ans) printf("%d ",i);
        printf("\n");
    }
 
    return 0;
}
