The article indicating those particular spirits which took part in that scene. Mark's precision is shown in the use of the two articles and in the arrangement of the noun and adjective: The spirits, the unclean ones.
When they saw (ὅταν ἐθεώρουν)
More accurately as Rev., whenever they beheld. The imperfect tense denotes a repeated act. The ἄν in ὅταν gives an indefinite force: as often as they might see him.