Today Johnny wants to increase his contribution. His plan assumes writing $$$n$$$ blogs. One blog covers one topic, but one topic can be covered by many blogs. Moreover, some blogs have references to each other. Each pair of blogs that are connected by a reference has to cover different topics because otherwise, the readers can notice that they are split just for more contribution. Set of blogs and bidirectional references between some pairs of them is called blogs network.There are $$$n$$$ different topics, numbered from $$$1$$$ to $$$n$$$ sorted by Johnny's knowledge. The structure of the blogs network is already prepared. Now Johnny has to write the blogs in some order. He is lazy, so each time before writing a blog, he looks at it's already written neighbors (the blogs referenced to current one) and chooses the topic with the smallest number which is not covered by neighbors. It's easy to see that this strategy will always allow him to choose a topic because there are at most $$$n - 1$$$ neighbors.For example, if already written neighbors of the current blog have topics number $$$1$$$, $$$3$$$, $$$1$$$, $$$5$$$, and $$$2$$$, Johnny will choose the topic number $$$4$$$ for the current blog, because topics number $$$1$$$, $$$2$$$ and $$$3$$$ are already covered by neighbors and topic number $$$4$$$ isn't covered.As a good friend, you have done some research and predicted the best topic for each blog. Can you tell Johnny, in which order he has to write the blogs, so that his strategy produces the topic assignment chosen by you?

The first line contains two integers $$$n$$$ $$$(1 \leq n \leq 5 \cdot 10^5)$$$ and $$$m$$$ $$$(0 \leq m \leq 5 \cdot 10^5)$$$ — the number of blogs and references, respectively. Each of the following $$$m$$$ lines contains two integers $$$a$$$ and $$$b$$$ ($$$a \neq b$$$; $$$1 \leq a, b \leq n$$$), which mean that there is a reference between blogs $$$a$$$ and $$$b$$$. It's guaranteed that the graph doesn't contain multiple edges. The last line contains $$$n$$$ integers $$$t_1, t_2, \ldots, t_n$$$, $$$i$$$-th of them denotes desired topic number of the $$$i$$$-th blog ($$$1 \le t_i \le n$$$).

If the solution does not exist, then write $$$-1$$$. Otherwise, output $$$n$$$ distinct integers $$$p_1, p_2, \ldots, p_n$$$ $$$(1 \leq p_i \leq n)$$$, which describe the numbers of blogs in order which Johnny should write them. If there are multiple answers, print any.

NoteIn the first example, Johnny starts with writing blog number $$$2$$$, there are no already written neighbors yet, so it receives the first topic. Later he writes blog number $$$1$$$, it has reference to the already written second blog, so it receives the second topic. In the end, he writes blog number $$$3$$$, it has references to blogs number $$$1$$$ and $$$2$$$ so it receives the third topic.Second example: There does not exist any permutation fulfilling given conditions.Third example: First Johnny writes blog $$$2$$$, it receives the topic $$$1$$$. Then he writes blog $$$5$$$, it receives the topic $$$1$$$ too because it doesn't have reference to single already written blog $$$2$$$. Then he writes blog number $$$1$$$, it has reference to blog number $$$2$$$ with topic $$$1$$$, so it receives the topic $$$2$$$. Then he writes blog number $$$3$$$ which has reference to blog $$$2$$$, so it receives the topic $$$2$$$. Then he ends with writing blog number $$$4$$$ which has reference to blog $$$5$$$ and receives the topic $$$2$$$.

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	// nより大きいトピックがあったらNG
	for i := 0; i < n; i++ {
		if T[i] > n {
			fmt.Println(-1)
			return
		}
	}

	// 同じトピックが隣接していたらアウト
	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	// 孤立したブログは1以外ありえない
	for i := 0; i < n; i++ {
		if len(G[i]) == 0 && T[i] != 1 {
			fmt.Println(-1)
			return
		}
	}

	// トピックが飛んでいたらアウト
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		memo[T[i]] = 1
	}
	maxt := Max(T...)
	if len(memo) != maxt {
		fmt.Println(-1)
		return
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		// if blogs[i].tid < blogs[j].tid {
		// 	return true
		// } else if blogs[i].tid > blogs[j].tid {
		// 	return false
		// } else {
		// 	return blogs[i].bid < blogs[j].bid
		// }
		return blogs[i].tid < blogs[j].tid
	})

	// for i := 0; i < n; i++ {
	// 	D[i] = 0
	// }
	answers := []int{}
	for i, blog := range blogs {
		// 以前のものよりトピックが飛んでいたらアウト
		if i >= 1 && blogs[i].tid-blogs[i-1].tid > 1 {
			fmt.Println(-1)
			return
		}

		// 隣接するものの最大をみる
		// maxi := 0
		// for _, t := range G[blog.bid] {
		// 	ChMax(&maxi, D[t])
		// }
		// if maxi+1 != blog.tid {
		// 	fmt.Println(-1)
		// 	return
		// }
		// blog.tid未満がすべて存在するかどうか調べる
		memo := make(map[int]int)
		for _, t := range G[blog.bid] {
			if 1 <= D[t] && D[t] < blog.tid {
				memo[D[t]] = 1
			}
		}
		if len(memo) != blog.tid-1 {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import (
	"os"
	"sort"
)

func main() {
	st, _ := os.Stdin.Stat()
	buf := make([]byte, st.Size())
	_, _ = os.Stdin.Read(buf)
	next := func() int {
		if buf[0] <= 32 {
			buf = buf[1:]
		}
		if buf[0] <= 32 {
			buf = buf[1:]
		}
		v := 0
		for buf[0] > 32 {
			v = v*10 + int(buf[0]-'0')
			buf = buf[1:]
		}
		return v
	}

	n, m := next(), next()
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, v := next()-1, next()-1
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = next() - 1
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.Write([]byte("-1"))
	} else {
		out, oi := make([]byte, n*7), 0
		for _, u := range idx {
			u++
			l := oi + 6
			for u > 0 {
				out[l] = byte('0' + u%10)
				u /= 10
				l--
			}
			for l >= oi {
				out[l] = byte(' ')
				l--
			}
			oi += 7
		}
		os.Stdout.Write(out)
	}
}

package main

import (
	"bytes"
	"io/ioutil"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	all, _ := ioutil.ReadAll(os.Stdin)
	tokens := strings.Fields(string(all))

	n, _ := strconv.Atoi(tokens[0])
	m, _ := strconv.Atoi(tokens[1])
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, _ := strconv.Atoi(tokens[2+i*2])
		v, _ := strconv.Atoi(tokens[3+i*2])
		u--
		v--
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i], _ = strconv.Atoi(tokens[2+2*m+i])
		t[i]--
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.WriteString("-1")
	} else {
		out := make([][]byte, n)
		for i, u := range idx {
			out[i] = []byte(strconv.Itoa(u + 1))
		}
		os.Stdout.Write(bytes.Join(out, []byte{' '}))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func main() {
	reader := bufio.NewReader(os.Stdin)

	n, m := readTwoNums(reader)
	E := make([][]int, m)
	for i := 0; i < m; i++ {
		E[i] = readNNums(reader, 2)
	}
	T := readNNums(reader, n)

	res := solve(n, m, E, T)

	if len(res) == 0 {
		fmt.Println("-1")
		return
	}
	for i := 0; i < n; i++ {
		fmt.Printf("%d ", res[i])
	}
	fmt.Println()
}

func solve(n, m int, E [][]int, T []int) []int {
	X := make([]Item, n)

	for i := 0; i < n; i++ {
		X[i] = Item{i, T[i]}
	}

	sort.Sort(Items(X))

	degree := make([]int, n)

	for _, e := range E {
		u, v := e[0], e[1]
		degree[u-1]++
		degree[v-1]++
	}

	conn := make([][]int, n)

	for i := 0; i < n; i++ {
		conn[i] = make([]int, 0, degree[i])
	}

	for _, e := range E {
		u, v := e[0], e[1]
		u--
		v--
		conn[u] = append(conn[u], v)
		conn[v] = append(conn[v], u)
	}

	return solve1(n, X, conn)
}

func solve2(n int, X []Item, conn [][]int) []int {
	ans := make([]int, n)
	last := make([]int, n)
	res := make([]int, n)
	for i, x := range X {
		u := x.first
		for _, v := range conn[u] {
			last[ans[v]] = u
		}
		ans[u] = 1

		for last[ans[u]] == u {
			ans[u]++
		}
		if ans[u] != i {
			return nil
		}
		res[i] = u + 1
	}
	return res
}

func solve1(n int, X []Item, conn [][]int) []int {
	assign := make([]int, n)

	for i := 0; i < n; i++ {
		assign[i] = -1
	}

	mem := make(map[int]int)

	for _, item := range X {
		// cur == item.second
		u := item.first
		for _, v := range conn[u] {
			if assign[v] < 0 {
				continue
			}
			if assign[v] == item.second {
				return nil
			}
			if assign[v] < item.second {
				mem[assign[v]]++
			}
		}

		if len(mem) != item.second-1 {
			return nil
		}

		for _, v := range conn[u] {
			if assign[v] < 0 {
				continue
			}
			mem[assign[v]]--
			if mem[assign[v]] == 0 {
				delete(mem, assign[v])
			}
		}

		assign[u] = item.second
	}

	for i := 0; i < n; i++ {
		if assign[i] < 0 {
			return nil
		}
	}

	res := make([]int, n)

	for i, item := range X {
		res[i] = item.first + 1
	}

	return res
}

type Item struct {
	first, second int
}

type Items []Item

func (items Items) Len() int {
	return len(items)
}

func (items Items) Less(i, j int) bool {
	return items[i].second < items[j].second
}

func (items Items) Swap(i, j int) {
	items[i], items[j] = items[j], items[i]
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func main() {
	reader := bufio.NewReader(os.Stdin)

	n, m := readTwoNums(reader)
	E := make([][]int, m)
	for i := 0; i < m; i++ {
		E[i] = readNNums(reader, 2)
	}
	T := readNNums(reader, n)

	res := solve(n, m, E, T)

	if len(res) == 0 {
		fmt.Println("-1")
		return
	}
	var buf bytes.Buffer
	for i := 0; i < n; i++ {
		buf.WriteString(strconv.Itoa(res[i]))
		buf.WriteByte(' ')
	}
	fmt.Println(buf.String())
}

func solve(n, m int, E [][]int, T []int) []int {
	X := make([]Item, n)

	for i := 0; i < n; i++ {
		X[i] = Item{i, T[i]}
	}

	sort.Sort(Items(X))

	degree := make([]int, n)

	for _, e := range E {
		u, v := e[0], e[1]
		degree[u-1]++
		degree[v-1]++
	}

	conn := make([][]int, n)

	for i := 0; i < n; i++ {
		conn[i] = make([]int, 0, degree[i])
	}

	for _, e := range E {
		u, v := e[0], e[1]
		u--
		v--
		conn[u] = append(conn[u], v)
		conn[v] = append(conn[v], u)
	}

	return solve1(n, X, conn)
}

func solve2(n int, X []Item, conn [][]int) []int {
	ans := make([]int, n)
	last := make([]int, n)
	res := make([]int, n)
	for i, x := range X {
		u := x.first
		for _, v := range conn[u] {
			last[ans[v]] = u
		}
		ans[u] = 1

		for last[ans[u]] == u {
			ans[u]++
		}
		if ans[u] != i {
			return nil
		}
		res[i] = u + 1
	}
	return res
}

func solve1(n int, X []Item, conn [][]int) []int {
	assign := make([]int, n)

	for i := 0; i < n; i++ {
		assign[i] = -1
	}

	mem := make(map[int]int)

	for _, item := range X {
		// cur == item.second
		u := item.first
		for _, v := range conn[u] {
			if assign[v] < 0 {
				continue
			}
			if assign[v] == item.second {
				return nil
			}
			if assign[v] < item.second {
				mem[assign[v]]++
			}
		}

		if len(mem) != item.second-1 {
			return nil
		}

		for _, v := range conn[u] {
			if assign[v] < 0 {
				continue
			}
			mem[assign[v]]--
			if mem[assign[v]] == 0 {
				delete(mem, assign[v])
			}
		}

		assign[u] = item.second
	}

	for i := 0; i < n; i++ {
		if assign[i] < 0 {
			return nil
		}
	}

	res := make([]int, n)

	for i, item := range X {
		res[i] = item.first + 1
	}

	return res
}

type Item struct {
	first, second int
}

type Items []Item

func (items Items) Len() int {
	return len(items)
}

func (items Items) Less(i, j int) bool {
	return items[i].second < items[j].second
}

func (items Items) Swap(i, j int) {
	items[i], items[j] = items[j], items[i]
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func main() {
	reader := bufio.NewReader(os.Stdin)

	n, m := readTwoNums(reader)
	E := make([][]int, m)
	for i := 0; i < m; i++ {
		E[i] = readNNums(reader, 2)
	}
	T := readNNums(reader, n)

	res := solve(n, m, E, T)

	if len(res) == 0 {
		fmt.Println("-1")
		return
	}
	for i := 0; i < n; i++ {
		fmt.Printf("%d ", res[i])
	}
	fmt.Println()
}

func solve(n, m int, E [][]int, T []int) []int {
	X := make([]Item, n)

	for i := 0; i < n; i++ {
		X[i] = Item{i, T[i]}
	}

	sort.Sort(Items(X))

	degree := make([]int, n)

	for _, e := range E {
		u, v := e[0], e[1]
		degree[u-1]++
		degree[v-1]++
	}

	conn := make([][]int, n)

	for i := 0; i < n; i++ {
		conn[i] = make([]int, 0, degree[i])
	}

	for _, e := range E {
		u, v := e[0], e[1]
		u--
		v--
		conn[u] = append(conn[u], v)
		conn[v] = append(conn[v], u)
	}

	assign := make([]int, n)

	for i := 0; i < n; i++ {
		assign[i] = -1
	}

	mem := make(map[int]int)

	for _, item := range X {
		// cur == item.second
		u := item.first
		for _, v := range conn[u] {
			if assign[v] < 0 {
				continue
			}
			if assign[v] == item.second {
				return nil
			}
			if assign[v] < item.second {
				mem[assign[v]]++
			}
		}

		if len(mem) != item.second-1 {
			return nil
		}

		for _, v := range conn[u] {
			if assign[v] < 0 {
				continue
			}
			mem[assign[v]]--
			if mem[assign[v]] == 0 {
				delete(mem, assign[v])
			}
		}

		assign[u] = item.second
	}

	for i := 0; i < n; i++ {
		if assign[i] < 0 {
			return nil
		}
	}

	res := make([]int, n)

	for i, item := range X {
		res[i] = item.first + 1
	}

	return res
}

type Item struct {
	first, second int
}

type Items []Item

func (items Items) Len() int {
	return len(items)
}

func (items Items) Less(i, j int) bool {
	return items[i].second < items[j].second
}

func (items Items) Swap(i, j int) {
	items[i], items[j] = items[j], items[i]
}

package main

import (
	"bytes"
	"os"
	"sort"
	"strconv"
)

func main() {
	st, _ := os.Stdin.Stat()
	buf := make([]byte, st.Size())
	_, _ = os.Stdin.Read(buf)
	bi := 0
	next := func() int {
		for buf[bi] <= 32 {
			bi++
		}
		v := 0
		for buf[bi] > 32 {
			v = v*10 + int(buf[bi]-'0')
			bi++
		}
		return v
	}

	n, m := next(), next()
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, v := next()-1, next()-1
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = next() - 1
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.WriteString("-1")
	} else {
		out := make([][]byte, n)
		for i, u := range idx {
			out[i] = []byte(strconv.Itoa(u + 1))
		}
		os.Stdout.Write(bytes.Join(out, []byte{' '}))
	}
}

package main

import (
	"bytes"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	st, _ := os.Stdin.Stat()
	all := make([]byte, st.Size())
	_, _ = os.Stdin.Read(all)
	tokens := strings.Fields(string(all))

	n, _ := strconv.Atoi(tokens[0])
	m, _ := strconv.Atoi(tokens[1])
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, _ := strconv.Atoi(tokens[2+i*2])
		v, _ := strconv.Atoi(tokens[3+i*2])
		u--
		v--
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i], _ = strconv.Atoi(tokens[2+2*m+i])
		t[i]--
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.WriteString("-1")
	} else {
		out := make([][]byte, n)
		for i, u := range idx {
			out[i] = []byte(strconv.Itoa(u + 1))
		}
		os.Stdout.Write(bytes.Join(out, []byte{' '}))
	}
}

package main

import (
	"bytes"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	st, _ := os.Stdin.Stat()
	buf := make([]byte, st.Size())
	_, _ = os.Stdin.Read(buf)
	tokens := strings.Fields(string(buf))

	n, _ := strconv.Atoi(tokens[0])
	m, _ := strconv.Atoi(tokens[1])
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, _ := strconv.Atoi(tokens[2+i*2])
		v, _ := strconv.Atoi(tokens[3+i*2])
		u--
		v--
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i], _ = strconv.Atoi(tokens[2+2*m+i])
		t[i]--
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.WriteString("-1")
	} else {
		out := make([][]byte, n)
		for i, u := range idx {
			out[i] = []byte(strconv.Itoa(u + 1))
		}
		os.Stdout.Write(bytes.Join(out, []byte{' '}))
	}
}

package main

import (
	"fmt"
	"io/ioutil"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	all, _ := ioutil.ReadAll(os.Stdin)
	tokens := strings.Fields(string(all))

	n, _ := strconv.Atoi(tokens[0])
	m, _ := strconv.Atoi(tokens[1])
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, _ := strconv.Atoi(tokens[2+i*2])
		v, _ := strconv.Atoi(tokens[3+i*2])
		u--
		v--
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i], _ = strconv.Atoi(tokens[2+2*m+i])
		t[i]--
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		fmt.Println("-1")
	} else {
		for _, u := range idx {
			fmt.Printf("%d ", u+1)
		}
		fmt.Println()
	}
}

package main

import (
	"bytes"
	"os"
	"sort"
	"strconv"
)

func main() {
	st, _ := os.Stdin.Stat()
	buf := make([]byte, st.Size())
	_, _ = os.Stdin.Read(buf)
	bi := 0
	next := func() int {
		if buf[bi] <= 32 {
			bi++
		}
		if buf[bi] <= 32 {
			bi++
		}
		v := 0
		for buf[bi] > 32 {
			v = v*10 + int(buf[bi]-'0')
			bi++
		}
		return v
	}

	n, m := next(), next()
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, v := next()-1, next()-1
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = next() - 1
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.WriteString("-1")
	} else {
		out := make([][]byte, n)
		for i, u := range idx {
			out[i] = []byte(strconv.Itoa(u + 1))
		}
		os.Stdout.Write(bytes.Join(out, []byte{' '}))
	}
}

package main

import (
	"os"
	"sort"
)

func main() {
	st, _ := os.Stdin.Stat()
	buf, bi := make([]byte, st.Size()), 0
	_, _ = os.Stdin.Read(buf)
	next := func() int {
		if buf[bi] <= 32 {
			bi++
		}
		if buf[bi] <= 32 {
			bi++
		}
		v := 0
		for buf[bi] > 32 {
			v = v*10 + int(buf[bi]-'0')
			bi++
		}
		return v
	}

	n, m := next(), next()
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, v := next()-1, next()-1
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = next() - 1
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.Write([]byte("-1"))
	} else {
		out, oi := make([]byte, n*7), 0
		for _, u := range idx {
			u++
			l := oi + 6
			for u > 0 {
				out[l] = byte('0' + u%10)
				u /= 10
				l--
			}
			for l >= oi {
				out[l] = byte(' ')
				l--
			}
			oi += 7
		}
		os.Stdout.Write(out)
	}
}

package main

import (
	"io/ioutil"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	all, _ := ioutil.ReadAll(os.Stdin)
	tokens := strings.Fields(string(all))

	n, _ := strconv.Atoi(tokens[0])
	m, _ := strconv.Atoi(tokens[1])
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, _ := strconv.Atoi(tokens[2+i*2])
		v, _ := strconv.Atoi(tokens[3+i*2])
		u--
		v--
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i], _ = strconv.Atoi(tokens[2+2*m+i])
		t[i]--
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.WriteString("-1")
	} else {
		out := make([]string, n)
		for i, u := range idx {
			out[i] = strconv.Itoa(u + 1)
		}
		os.Stdout.WriteString(strings.Join(out, " "))
	}
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	// 同じトピックが隣接していたらアウト
	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	// 孤立したブログは1以外ありえない
	for i := 0; i < n; i++ {
		if len(G[i]) == 0 && T[i] != 1 {
			fmt.Println(-1)
			return
		}
	}

	// トピックが飛んでいたらアウト
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		memo[T[i]] = 1
	}
	maxt := Max(T...)
	if len(memo) != maxt {
		fmt.Println(-1)
		return
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for i, blog := range blogs {
		// 以前のものよりトピックが飛んでいたらアウト
		if i >= 1 && blogs[i].tid-blogs[i-1].tid > 1 {
			fmt.Println(-1)
			return
		}

		// 隣接するものの最大をみる
		maxi := 0
		for _, t := range G[blog.bid] {
			ChMax(&maxi, D[t])
		}
		if maxi+1 < blog.tid {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for _, blog := range blogs {
		answers = append(answers, blog.bid+1)
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for i, blog := range blogs {
		// // blog.bidの隣接ノードをすべてチェックする
		// mini := 0
		// for _, t := range G[blog.bid] {
		// 	ChMax(&mini, D[t])
		// }
		// if mini+1 != blog.tid {
		// 	fmt.Println(-1)
		// 	return
		// }

		if i >= 1 && blogs[i].tid-blogs[i-1].tid > 1 {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		// D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	// 同じトピックが隣接していたらアウト
	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	// 孤立したブログは1以外ありえない
	for i := 0; i < n; i++ {
		if len(G[i]) == 0 && T[i] != 1 {
			fmt.Println(-1)
			return
		}
	}

	// トピックが飛んでいたらアウト
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		memo[T[i]] = 1
	}
	maxt := Max(T...)
	if len(memo) != maxt {
		fmt.Println(-1)
		return
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for _, blog := range blogs {
		// 隣接するものの最大をみる
		maxi := 0
		for _, t := range G[blog.bid] {
			ChMax(&maxi, D[t])
		}
		if maxi+1 < blog.tid {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	// 同じトピックが隣接していたらアウト
	for i := 0; i < n; i++ {
		if len(G[i]) == 0 && T[i] != 1 {
			fmt.Println(-1)
			return
		}
	}

	// トピックが飛んでいたらアウト
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		memo[T[i]] = 1
	}
	maxt := Max(T...)
	if len(memo) != maxt {
		fmt.Println(-1)
		return
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for _, blog := range blogs {
		// 隣接するものの最大をみる
		maxi := 0
		for _, t := range G[blog.bid] {
			ChMax(&maxi, D[t])
		}
		if maxi+1 != blog.tid {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for _, blog := range blogs {
		// blog.bidの隣接ノードをすべてチェックする
		mini := 0
		for _, t := range G[blog.bid] {
			ChMax(&mini, D[t])
		}
		if mini+1 != blog.tid {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	// 同じトピックが隣接していたらアウト
	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	// 孤立したブログは1以外ありえない
	for i := 0; i < n; i++ {
		if len(G[i]) == 0 && T[i] != 1 {
			fmt.Println(-1)
			return
		}
	}

	// トピックが飛んでいたらアウト
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		memo[T[i]] = 1
	}
	maxt := Max(T...)
	if len(memo) != maxt {
		fmt.Println(-1)
		return
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for i, blog := range blogs {
		// 以前のものよりトピックが飛んでいたらアウト
		if i >= 1 && blogs[i].tid-blogs[i-1].tid > 1 {
			fmt.Println(-1)
			return
		}

		// 隣接するものの最大をみる
		maxi := 0
		for _, t := range G[blog.bid] {
			ChMax(&maxi, D[t])
		}
		if maxi+1 != blog.tid {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	// nより大きいトピックがあったらNG
	for i := 0; i < n; i++ {
		if T[i] > n {
			fmt.Println(-1)
			return
		}
	}

	// 同じトピックが隣接していたらアウト
	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	// 孤立したブログは1以外ありえない
	for i := 0; i < n; i++ {
		if len(G[i]) == 0 && T[i] != 1 {
			fmt.Println(-1)
			return
		}
	}

	// トピックが飛んでいたらアウト
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		memo[T[i]] = 1
	}
	maxt := Max(T...)
	if len(memo) != maxt {
		fmt.Println(-1)
		return
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		// if blogs[i].tid < blogs[j].tid {
		// 	return true
		// } else if blogs[i].tid > blogs[j].tid {
		// 	return false
		// } else {
		// 	return blogs[i].bid < blogs[j].bid
		// }
		return blogs[i].tid < blogs[j].tid
	})

	answers := []int{}
	for i, blog := range blogs {
		// 以前のものよりトピックが飛んでいたらアウト
		if i >= 1 && blogs[i].tid-blogs[i-1].tid > 1 {
			fmt.Println(-1)
			return
		}

		// 隣接するものの最大をみる
		maxi := 0
		for _, t := range G[blog.bid] {
			ChMax(&maxi, D[t])
		}
		if maxi+1 != blog.tid {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	// nより大きいトピックがあったらNG
	for i := 0; i < n; i++ {
		if T[i] > n {
			fmt.Println(-1)
			return
		}
	}

	// 同じトピックが隣接していたらアウト
	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	// 孤立したブログは1以外ありえない
	for i := 0; i < n; i++ {
		if len(G[i]) == 0 && T[i] != 1 {
			fmt.Println(-1)
			return
		}
	}

	// トピックが飛んでいたらアウト
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		memo[T[i]] = 1
	}
	maxt := Max(T...)
	if len(memo) != maxt {
		fmt.Println(-1)
		return
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for i, blog := range blogs {
		// 以前のものよりトピックが飛んでいたらアウト
		if i >= 1 && blogs[i].tid-blogs[i-1].tid > 1 {
			fmt.Println(-1)
			return
		}

		// 隣接するものの最大をみる
		maxi := 0
		for _, t := range G[blog.bid] {
			ChMax(&maxi, D[t])
		}
		if maxi+1 != blog.tid {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	// nより大きいトピックがあったらNG
	for i := 0; i < n; i++ {
		if T[i] > n {
			fmt.Println(-1)
			return
		}
	}

	// 同じトピックが隣接していたらアウト
	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	// 孤立したブログは1以外ありえない
	for i := 0; i < n; i++ {
		if len(G[i]) == 0 && T[i] != 1 {
			fmt.Println(-1)
			return
		}
	}

	// トピックが飛んでいたらアウト
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		memo[T[i]] = 1
	}
	maxt := Max(T...)
	if len(memo) != maxt {
		fmt.Println(-1)
		return
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		// if blogs[i].tid < blogs[j].tid {
		// 	return true
		// } else if blogs[i].tid > blogs[j].tid {
		// 	return false
		// } else {
		// 	return blogs[i].bid < blogs[j].bid
		// }
		return blogs[i].tid < blogs[j].tid
	})

	for i := 0; i < n; i++ {
		D[i] = 0
	}
	answers := []int{}
	for i, blog := range blogs {
		// 以前のものよりトピックが飛んでいたらアウト
		if i >= 1 && blogs[i].tid-blogs[i-1].tid > 1 {
			fmt.Println(-1)
			return
		}

		// 隣接するものの最大をみる
		maxi := 0
		for _, t := range G[blog.bid] {
			ChMax(&maxi, D[t])
		}
		if maxi+1 != blog.tid {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	// 同じトピックが隣接していたらアウト
	for i := 0; i < n; i++ {
		if len(G[i]) == 0 && T[i] != 1 {
			fmt.Println(-1)
			return
		}
	}

	// トピックが飛んでいたらアウト
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		memo[T[i]] = 1
	}
	maxt := Max(T...)
	if len(memo) != maxt {
		fmt.Println(-1)
		return
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for _, blog := range blogs {
		answers = append(answers, blog.bid+1)
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	// 同じトピックが隣接していたらアウト
	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	// 同じトピックが隣接していたらアウト
	// for i := 0; i < n; i++ {
	// 	if len(G[i]) == 0 && T[i] != 1 {
	// 		fmt.Println(-1)
	// 		return
	// 	}
	// }

	// トピックが飛んでいたらアウト
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		memo[T[i]] = 1
	}
	maxt := Max(T...)
	if len(memo) != maxt {
		fmt.Println(-1)
		return
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for _, blog := range blogs {
		// 隣接するものの最大をみる
		maxi := 0
		for _, t := range G[blog.bid] {
			ChMax(&maxi, D[t])
		}
		if maxi+1 != blog.tid {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog

	D [500000 + 50]int
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	for i := 0; i < n; i++ {
		if len(G[i]) == 0 && T[i] != 1 {
			fmt.Println(-1)
			return
		}
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool {
		if blogs[i].tid < blogs[j].tid {
			return true
		} else if blogs[i].tid > blogs[j].tid {
			return false
		} else {
			return blogs[i].bid < blogs[j].bid
		}
	})

	answers := []int{}
	for i, blog := range blogs {
		// // blog.bidの隣接ノードをすべてチェックする
		// mini := 0
		// for _, t := range G[blog.bid] {
		// 	ChMax(&mini, D[t])
		// }
		// if mini+1 != blog.tid {
		// 	fmt.Println(-1)
		// 	return
		// }

		if i >= 1 && blogs[i].tid-blogs[i-1].tid > 1 {
			fmt.Println(-1)
			return
		}

		answers = append(answers, blog.bid+1)
		// D[blog.bid] = blog.tid
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1362/problem/D
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m  int
	A, B  []int
	T     []int
	G     [500000 + 50][]int
	blogs []Blog
)

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		a, b := ReadInt2()
		a--
		b--
		A = append(A, a)
		B = append(B, b)

		G[a] = append(G[a], b)
		G[b] = append(G[b], a)
	}
	T = ReadIntSlice(n)

	for i := 0; i < n; i++ {
		for _, t := range G[i] {
			if T[i] == T[t] {
				fmt.Println(-1)
				return
			}
		}
	}

	for i := 0; i < n; i++ {
		tid, bid := T[i], i
		blogs = append(blogs, Blog{tid: tid, bid: bid})
	}

	sort.SliceStable(blogs, func(i, j int) bool { return blogs[i].tid < blogs[j].tid })

	answers := []int{}
	for _, blog := range blogs {
		answers = append(answers, blog.bid+1)
	}
	fmt.Println(PrintIntsLine(answers...))
}

type Blog struct {
	tid, bid int
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import (
	"io/ioutil"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	all, _ := ioutil.ReadAll(os.Stdin)
	tokens := strings.Fields(string(all))

	n, _ := strconv.Atoi(tokens[0])
	m, _ := strconv.Atoi(tokens[1])
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, _ := strconv.Atoi(tokens[2+i*2])
		v, _ := strconv.Atoi(tokens[3+i*2])
		u--
		v--
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i], _ = strconv.Atoi(tokens[2+2*m+i])
		t[i]--
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.WriteString("-1")
	} else {
		out := make([]string, n)
		for i, u := range idx {
			out[i] = strconv.Itoa(u)
		}
		os.Stdout.WriteString(strings.Join(out, " "))
	}
}

package main

import (
	"os"
	"sort"
)

func main() {
	st, _ := os.Stdin.Stat()
	buf, bi := make([]byte, st.Size()), 0
	_, _ = os.Stdin.Read(buf)
	next := func() int {
		if buf[bi] <= 32 {
			bi++
		}
		if buf[bi] <= 32 {
			bi++
		}
		v := 0
		for buf[bi] > 32 {
			v = v*10 + int(buf[bi]-'0')
			bi++
		}
		return v
	}

	n, m := next(), next()
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, v := next()-1, next()-1
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = next() - 1
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.Write([]byte("-1"))
	} else {
		out, oi := make([]byte, n*6), 0
		for _, u := range idx {
			u++
			l := oi + 5
			for u > 0 {
				out[l] = byte('0' + u%10)
				u /= 10
				l--
			}
			for l >= oi {
				out[l] = byte(' ')
				l--
			}
			oi += 6
		}
		os.Stdout.Write(out)
	}
}

package main

import (
	"bytes"
	"os"
	"sort"
	"strconv"
)

func main() {
	st, _ := os.Stdin.Stat()
	buf := make([]byte, st.Size())
	_, _ = os.Stdin.Read(buf)
	bi := 0
	next := func() int {
		v := 0
		for buf[bi] > 32 {
			v = v*10 + int(buf[bi]-'0')
			bi++
		}
		return v
	}

	n, m := next(), next()
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, v := next()-1, next()-1
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = next() - 1
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.WriteString("-1")
	} else {
		out := make([][]byte, n)
		for i, u := range idx {
			out[i] = []byte(strconv.Itoa(u + 1))
		}
		os.Stdout.Write(bytes.Join(out, []byte{' '}))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func main() {
	reader := bufio.NewReader(os.Stdin)

	n, m := readTwoNums(reader)
	E := make([][]int, m)
	for i := 0; i < m; i++ {
		E[i] = readNNums(reader, 2)
	}
	T := readNNums(reader, n)

	res := solve(n, m, E, T)

	if len(res) == 0 {
		fmt.Println("-1")
		return
	}
	for i := 0; i < n; i++ {
		fmt.Printf("%d ", res[i])
	}
	fmt.Println()
}

func solve(n, m int, E [][]int, T []int) []int {
	X := make([]Item, n)

	for i := 0; i < n; i++ {
		X[i] = Item{i, T[i]}
	}

	sort.Sort(Items(X))

	degree := make([]int, n)

	for _, e := range E {
		u, v := e[0], e[1]
		degree[u-1]++
		degree[v-1]++
	}

	conn := make([][]int, n)

	for i := 0; i < n; i++ {
		conn[i] = make([]int, 0, degree[i])
	}

	for _, e := range E {
		u, v := e[0], e[1]
		u--
		v--
		conn[u] = append(conn[u], v)
		conn[v] = append(conn[v], u)
	}

	var cur int

	assign := make([]int, n)

	for i := 0; i < n; i++ {
		assign[i] = -1
	}

	for _, item := range X {
		if cur+1 == item.second {
			cur++
			assign[item.first] = cur
			continue
		}
		if cur+1 < item.second {
			//can't assign topic (second) as cur + 1
			return nil
		}
		// cur == item.second
		u := item.first
		mem := make(map[int]bool)
		for _, v := range conn[u] {
			if assign[v] == cur {
				return nil
			}
			if assign[v] > -1 {
				mem[assign[v]] = true
			}
		}

		if len(mem) != cur-1 {
			return nil
		}
		assign[u] = cur
	}

	for i := 0; i < n; i++ {
		if assign[i] < 0 {
			return nil
		}
	}

	res := make([]int, n)

	for i, item := range X {
		res[i] = item.first + 1
	}

	return res
}

type Item struct {
	first, second int
}

type Items []Item

func (items Items) Len() int {
	return len(items)
}

func (items Items) Less(i, j int) bool {
	return items[i].second < items[j].second
}

func (items Items) Swap(i, j int) {
	items[i], items[j] = items[j], items[i]
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func main() {
	reader := bufio.NewReader(os.Stdin)

	n, m := readTwoNums(reader)
	E := make([][]int, m)
	for i := 0; i < m; i++ {
		E[i] = readNNums(reader, 2)
	}
	T := readNNums(reader, n)

	res := solve(n, m, E, T)

	if len(res) == 0 {
		fmt.Println("-1")
		return
	}
	for i := 0; i < n; i++ {
		fmt.Printf("%d ", res[i])
	}
	fmt.Println()
}

func solve(n, m int, E [][]int, T []int) []int {
	X := make([]Item, n)

	for i := 0; i < n; i++ {
		X[i] = Item{i, T[i]}
	}

	sort.Sort(Items(X))

	degree := make([]int, n)

	for _, e := range E {
		u, v := e[0], e[1]
		degree[u-1]++
		degree[v-1]++
	}

	conn := make([][]int, n)

	for i := 0; i < n; i++ {
		conn[i] = make([]int, 0, degree[i])
	}

	for _, e := range E {
		u, v := e[0], e[1]
		u--
		v--
		conn[u] = append(conn[u], v)
		conn[v] = append(conn[v], u)
	}

	var cur int

	assign := make([]int, n)

	for i := 0; i < n; i++ {
		assign[i] = -1
	}

	for _, item := range X {
		if cur+1 == item.second {
			cur++
			assign[item.first] = cur
			continue
		}
		if cur+1 < item.second {
			//can't assign topic (second) as cur + 1
			return nil
		}
		// cur == item.second
		u := item.first
		mem := make(map[int]bool)
		for _, v := range conn[u] {
			if assign[v] == cur {
				return nil
			}
			if assign[v] > -1 {
				mem[assign[v]] = true
			}
		}

		if len(mem) != cur-1 {
			return nil
		}
		assign[u] = cur
	}

	res := make([]int, n)

	for i, item := range X {
		res[i] = item.first + 1
	}

	return res
}

type Item struct {
	first, second int
}

type Items []Item

func (items Items) Len() int {
	return len(items)
}

func (items Items) Less(i, j int) bool {
	return items[i].second < items[j].second
}

func (items Items) Swap(i, j int) {
	items[i], items[j] = items[j], items[i]
}

package main

import (
	"bytes"
	"os"
	"sort"
	"strconv"
)

func main() {
	st, _ := os.Stdin.Stat()
	buf := make([]byte, st.Size()+1)
	_, _ = os.Stdin.Read(buf)
	bi := 0
	next := func() int {
		v := 0
		for buf[bi] > 32 {
			v = v*10 + int(buf[bi]-'0')
			bi++
		}
		return v
	}

	n, m := next(), next()
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, v := next()-1, next()-1
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = next() - 1
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.WriteString("-1")
	} else {
		out := make([][]byte, n)
		for i, u := range idx {
			out[i] = []byte(strconv.Itoa(u + 1))
		}
		os.Stdout.Write(bytes.Join(out, []byte{' '}))
	}
}

package main

import (
	"fmt"
	"io/ioutil"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	all, _ := ioutil.ReadAll(os.Stdin)
	tokens := strings.Fields(string(all))

	n, _ := strconv.Atoi(tokens[0])
	m, _ := strconv.Atoi(tokens[1])
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, _ := strconv.Atoi(tokens[2+i*2])
		v, _ := strconv.Atoi(tokens[3+i*2])
		u--
		v--
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i], _ = strconv.Atoi(tokens[2+2*m+i])
		t[i]--
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		fmt.Println("-1")
	} else {
		for _, u := range idx {
			fmt.Printf("%d ", u)
		}
		fmt.Println()
	}
}

package main

import (
	"bytes"
	"os"
	"sort"
	"strconv"
)

func main() {
	st, _ := os.Stdin.Stat()
	buf := make([]byte, st.Size())
	_, _ = os.Stdin.Read(buf)
	bi := 0
	next := func() int {
		for buf[bi] < 32 {
			bi++
		}
		v := 0
		for buf[bi] > 32 {
			v = v*10 + int(buf[bi]-'0')
			bi++
		}
		return v
	}

	n, m := next(), next()
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		u, v := next()-1, next()-1
		g[u] = append(g[u], v)
		g[v] = append(g[v], u)
	}
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = next() - 1
	}

	idx := make([]int, n)
	for i := 0; i < n; i++ {
		idx[i] = i
	}
	sort.Slice(idx, func(i, j int) bool {
		if t[idx[i]] == t[idx[j]] {
			return idx[i] < idx[j]
		}
		return t[idx[i]] < t[idx[j]]
	})

	mk := make([]bool, n)
	imp := false
	for _, u := range idx {
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = true
			}
		}
		mex := 0
		for i, v := range mk {
			if !v {
				mex = i
				break
			}
		}
		if mex != t[u] {
			imp = true
			break
		}
		for _, v := range g[u] {
			if t[v] < 0 {
				mk[-t[v]-1] = false
			}
		}
		t[u] = -t[u] - 1
	}

	if imp {
		os.Stdout.WriteString("-1")
	} else {
		out := make([][]byte, n)
		for i, u := range idx {
			out[i] = []byte(strconv.Itoa(u + 1))
		}
		os.Stdout.Write(bytes.Join(out, []byte{' '}))
	}
}