One mole of any element contains #6.022xx10^23# atoms of that element. The molar mass of an element is the mass in grams of one mole of the element, which is its relative atomic mass (atomic weight) on the periodic table in g/mol.

Potassium, #"K"#, has the relative atomic mass #39.0983#, therefore its molar mass is #"39.0983 g/mol"#.

We need to make the following conversions.

#"mass K"##rarr##"mol K"##rarr##"atoms K"#

Divide the given mass by molar mass, then multiply by #6.022xx10^23"atoms/mol"#.

#3.40cancel"g K"xx(1cancel"mol K")/(39.0983cancel"g K")xx(6.022xx10^23"atoms K")/(1cancel"mol K")=color(blue)(5.24xx10^22"atoms K")# (rounded to three significant figures)