For a real number \(k,\) let \(A\) be the set of roots of \(x^2 + (k - 1) x - 2(k + 1) = 0,\) and let \(B\) be the set of roots of \((k - 1) x^2 + kx + 1 = 0.\) (These roots may be complex.) Find the number of values of \(k\) so that \(|A \cup B| = 3.\)