open Array
let print x y = print_int x; print_string " "; print_int y; print_newline ()
let () =
  let rec make_list n = if n = 0 then [0] else n :: make_list (n-1) in
  let n,m = Scanf.scanf "%d %d\n" @@ fun a b -> a, b in
  let h = init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  let arr = Array.make n 0 in
  for i = 1 to m do
    Scanf.scanf "%d %d\n" @@ fun x y ->
    let a = x-1 in let b = y-1 in
    set arr a (max (max h.(a) arr.(a)) h.(b));
    set arr b (max (max h.(b) arr.(b)) h.(a));
  done;
  print_int (List.fold_left
               (fun i v -> if h.(v) >= arr.(v) then i+1 else i) 0 (make_list (n-1)))