ElGamal: Why is reusing the same $k$ not secure? I have a question on the encryption process of ElGamal:
$$  
  Y = g ^ a \bmod p \\
  C = g ^ k \bmod p \quad\text{($k$ is chosen randomly)} \\
  D = m \cdot y ^ k \bmod p \\
  \text{Decryption:}\qquad m = C^{(p-1-a)}\cdot D\bmod p
$$

My professor told us we should know why it's bad to use the same values for the variables $a$ and $k$ more than once, but he didn't say why. I guess that if the same values for $a$ and $k$ are used several times, the attacker could calculate the unknown values if he is able to capture the traffic, but I don't know how.

How could an attacker proceed there?
In ElGamal encryption like you said for unknown $m_1$ and known $m_2$ we have:

$m_1: C_1=g^k\ mod\ p,\  D_1=m_1.g^{a.k}$

$m_2: C_2=g^k\ mod\ p,\  D_2=m_2.g^{a.k}$

$k$ is the same in both encryptions, by dividing $D_1$ and $D_2$ we have:

${D_1\over D_2}={m_1\over m_2} =&gt; D_1.m_2 = D_2.m_1$

$m_2$ , $D_1$ and $D_2$ and are known so now we can calculate $m_1$. This is how can attacker proceed and find unknown $m_1$.