let split_string ?(pattern=" ") = Str.split @@ Str.regexp pattern
let (n, k) = Scanf.sscanf (read_line ()) "%d %d" @@ fun n k -> (n, k)
let aa = Array.init k @@ fun _ -> ignore(read_line ()); read_line () |> split_string |> List.map int_of_string

let ans = Array.make_matrix n k false

let () =
  Array.iteri (fun k -> List.iter (fun i -> ans.(i - 1).(k) <- true)) aa;
  for i = 0 to n - 1 do
    for j = 1 to k - 1 do
      ans.(i).(j) <- ans.(i).(j) || ans.(i).(j - 1)
    done
  done;
  let sum = ref 0 in
  for i = 0 to n - 1 do
    if not ans.(i).(k - 1) then sum := !sum + 1
  done;
  Printf.printf "%d\n" !sum
