mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.buffer.readline def fin(): print("YES") exit() N, M = map(int, input().split()) A = [0] + list(map(int, input().split())) adj = [[] for _ in range(N+1)] for _ in range(M): a, b = map(int, input().split()) adj[a].append(b) adj[b].append(a) for v in range(1, N+1): a = A[v] small = set() large = set() for u in adj[v]: if A[u] < a: small.add(A[u]) elif A[u] > a: large.add(A[u]) if len(small) > 1 or len(large) > 1: fin() print(v) print("NO") if __name__ == '__main__': main()