LCM Divisible Subsequence

You’ll be given an array of $N$ integers and two more integers $K$ and $M$. You have to find the number of lcm divisible subsequence of length $M$ in that array.


This is a companion discussion topic for the original entry at https://toph.co/p/lcm-divisible-subsequence