Physical Address space is 2^P bytes i.e. P bits to represent total memory.
Cache Size 2^N i.e. bits to represent Cache memory.
K way associative.
(Size of Tag in bits) + (Cache Size/K in bits) = (Total memory in bits)
(Size of Tag in bits) + N-log(K) = P
(Size of Tag in bits) = P - N + log(K)