Generally, the non-metals do not react with dilute acids. This is because when a substance reacts with acids, it provides electrons to the H+ ions produced by the acids. Non-metals are themselves acceptors of electrons so there is no way they can donate electrons to the hydrogen ion of the acid. Hence, non-metals in general do not react with dilute acids.
However, some none metals are the exceptions which react with strong acid and oxidized to their corresponding oxide. Like, P,S, carbon etc.
For ex: 6HNO3+ S - H2SO4+ 6NO2+ 2H2O