#include <bits/stdc++.h>   using namespace std;   long long spf[100001];   bool isPrime(long long n) {     if (n <= 1) return false;     if (n <= 3) return true;     if (n % 2 == 0 || n % 3 == 0) return false;     for (long long i = 5; i * i <= n; i = i + 6)       if (n % i == 0 || n % (i + 2) == 0) return false;     return true;   }   long long power(long long a, long long b) {     long long res = 1;     while (b > 0) {       if (b & 1) res = (res * a);       a = (a * a);       b >>= 1;     }     return res;   }   long long modpow(long long a, long long b, long long x) {     long long res = 1;     while (b > 0) {       if (b & 1) res = (res * a) % x;       a = (a * a) % x;       b >>= 1;     }     return res;   }   void sieve() {     spf[1] = 1;     for (long long i = 2; i < 100001; i++) spf[i] = i;     for (long long i = 4; i < 100001; i += 2) spf[i] = 2;     for (long long i = 3; i * i < 100001; i++)       if (spf[i] == i)         for (long long j = i * i; j < 100001; j += i)           if (spf[j] == j) spf[j] = i;   }   vector<long long> getFactorization(long long x) {     vector<long long> ret;     while (x != 1) {       ret.push_back(spf[x]);       x = x / spf[x];     }     return ret;   }   void solve() {     long long n, m;     cin >> n >> m;     vector<long long> adj[n + 1];     for (int i = 0; i < m; i++) {       long long a, b;       cin >> a >> b;       adj[a].push_back(b);       adj[b].push_back(a);     }     vector<pair<long long, long long>> topic(n);     for (int i = 0; i < n; i++) {       long long a;       cin >> a;       topic[i] = {a, i + 1};     }     sort(topic.begin(), topic.end());     vector<long long> res;     vector<set<long long>> around(n + 1);     for (int i = 0; i < topic.size(); i++) {       long long u = topic[i].second;       res.push_back(u);       if (around[u].find(topic[i].first) != around[u].end() ||           around[u].size() != topic[i].first - 1) {         cout << -1 <<   n ;         return;       }       for (auto j : adj[u]) {         around[j].insert(topic[i].first);       }     }     for (auto i : res) cout << i <<    ;     cout <<   n ;     ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long t = 1;     while (t--) solve();     return 0;   }   