find $a$ and $k$ for a given el gamal cryptosystem
I found the answer after getting a hint from my professor

basically if we have an equation in to form

$$m*x = (m*y) mod (m*z)$$ 
we can factor out m such that:
$$x = (y) mod (z)$$

but...
the only caveat is that there are m solutions for x:
$$
x, x+z, x+2*z, ..., x+(m-1)z = (m*y) mod (m*z)
$$
using this we can solve the equation in the question $$a(23972)=(23704) mod (31846)$$
even though 23972 is not invertable mod 31846.

start by factoring out 2 from everything
$$2a(11986) = 2(11852) mod 2(15923)$$

this gives:
$$
a(11986) = 11852 mod 15923
$$

solving for a:
$$
a = (11852)(11986)^{-1} mod 15923 = (11852)(182) mod 15923 = 7459 mod 15923
$$
now the multiple solution part:

where  $$m = 2$$ and $$z = 15923$$ in our case

a = 7459 mod mz and 7459 + z mod mz

so $$a = (7459) mod (31846), (23382) mod (31846)$$
and $$k = (1162) mod (31846)$$