Let \( z \) be a complex number satisfying \( 12|z|^2 = 2|z+2|^2 + |z^2+1|^2 + 31 \). The original answer for \( z + \frac{6}{z} \) is in the form of k + m, where k and m are integers. Please find the value of k + m.

Let's think step by step and output the final answer within \boxed{}.
user