Harry Vs Voldemort

Limits: 1s, 256 MB

In the year 3018, Harry Potter is facing a fight with Lord Voldemort. Lord Voldemort has a wand that has a magical power of K. Now to defeat lord Voldemort, Harry has to make a wand from spells. Harry knows N number of spells but there is a problem. Each spell has a strength of magical power and lord Voldemort is knocking at the door. To defeat Voldemort, Harry has to have a more powerful wand than of his opponent. With no time in hand, Harry wants to make the wand with least number of spells, if at all possible. Now, you are Dobby, a programmer from the past 2018. Ron took you to the future and now Harry wants you to calculate the minimum number of spells he will need to defeat lord Voldemort. Can you help him?

This is a companion discussion topic for the original entry at https://toph.co/p/harry-vs-voldemort