The trick here is to realize that potassium nitrate, #"KNO"_3#, is soluble in water, which implies that it dissociates completely in aqueous solution to produce potassium cations and nitrate anions.
#"KNO"_ (3(aq)) -> "K"_ ((aq))^(+) + "NO"_ (3(aq))^(-)#
As you can see, for every #1# mole of potassium nitrate that dissociates, you get #1# mole of potassium cations and #1# mole of nitrate anions.
This means that when you dissolve #2# moles of potassium nitrate in enough water, your solution will contain
#2 color(red)(cancel(color(black)("moles KNO"_3))) * "2 moles ions"/(1color(red)(cancel(color(black)("mole KNO"_3)))) = "4 moles ions"#
A solute that produces #2# moles of particles of solute, which in this case are ions, for every #1# mole of solute dissolved to make the solution is said to havea van't Hoff factor equal to #2#.
If you want the actual number of ions formed in the solution, use the fact that #1# mole of ions contains #6.022 * 10^(23)# ions #-># this is known as Avogadro's constant, #N_"A"#.
So in your case, the number of ions produced in the solution would be equal to #4 * N_"A"#.