open Array
let rec make_list n = if n = 0 then [] else n :: make_list (n-1)
let n,k = Scanf.scanf "%d %d\n" @@ fun a b -> a, b
let lst = to_list (init k @@ fun _ -> Scanf.scanf "%d\n" @@
  fun d -> to_list (init d @@ fun _ -> Scanf.scanf "%d " @@ fun x -> x))
let rec f arr lst = match arr with
  | [] -> lst
  | hl :: t -> f t (List.filter (fun x -> not (List.mem x hl)) lst)
let () = print_int (List.length (f lst (make_list n)))