from heapq import heappop,heappush N,M=map(int,input().split()) H=[0]+list(map(int,input().split())) E=[[] for i in range(N+1)] for i in range(M): a,b=map(int,input().split()) E[a].append(b) E[b].append(a) def bfs(x): Q=[x] D=[-1]*(N+9) Q=[(0,x)] D[x]=0 while Q: dis,x=heappop(Q) if D[x]!=dis: continue for to in E[x]: if H[to]>H[x] and D[to]=0 and D2[i]>=0: ANS=max(ANS,D1[i]+D2[i]) print(ANS+1)