Write the shortest code in any language of your choice to find the Nth K-ugly number.
A K-ugly number is a number whose only prime factors are the prime numbers <= K. This K-ugly number is popularly known as a K-smooth number.
0 < N < 1000
0 < k < 25
- N K (separated by a single space)
- -1 (if no such number exists)
- M (if Nth K-ugly number is M)