from collections import deque 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=deque([x]) D[x]=0 while Q: x=Q.popleft() 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)