import java.util.*

object MainKt {
	@JvmStatic
	fun main(args: Array<String>) {
		val scanner = Scanner(System.`in`)
		val n = scanner.nextInt()
		val m = scanner.nextInt()
		var cnt = 0
		var a = -1
		var px=0
		var py=1
		for (i in 1..n){
			if (cnt<m && a<i) {
				a=scanner.nextInt()
				cnt++
			}
			val pz = if (a==i) 0 else (px+py)%1_000_000_007
			px=py
			py=pz
		}
		println(py)
	}
}