The 1st involving NaSH as the nucleophile is SN2
The 2nd involving CH3OH as the nucleophile is SN1.
Both involve a secondary alkyl halide which can be used in either SN2 or SN1 so this is of no help.
The key is the nucleophiles. As Na is a metal, NaSH is ionic and therefore is really Na+ and -SH. A negatively charged nucleophile is typically strong (and -SH is indeed strong) and will lean us toward SN2.
On the other hand, CH3OH is not ionic, and is not negatively charged and is a weak nucleophile (alcohols are no more nucleophilic than H2O which is really weak itself). With a weak nucleophile, SN2 is not possible so we're left with SN1.
A general rule which works most of the time:
strong nuc (neg. charged) = SN2 (but no tertiary halides)
weak nuc (not neg. charged) = SN1
There are exceptions but, again, it works most of the time.