This slides could help you understand ElGamal Encryption better.