fun main(args: Array<String>) {
	val (n, q) = (readLine() ?: return).split(" ").map { it.toInt() }
	val s = readLine() ?: return

	val input = Array(q) { (readLine() ?: return).split(" ").toTypedArray() }

	val left = rec(s, input, 0)
	val right = rec(s, input, n - 1)
	if (left == right) {
		println(0)
		return
	}

	val leftP = when {
		left >= 0 -> 0
		else -> {
			var l = 0
			var r = n - 1
			while (l + 1 < r) {
				val m = l + (r - l) / 2
				val mid = rec(s, input, m)
				if (mid < 0) l = m
				else r = m
			}
			r
		}
	}
	val rightP = when {
		right <= n-1 -> n-1
		else -> {
			var l = 0
			var r = n - 1
			while (l + 1 < r) {
				val m = l + (r - l) / 2
				val mid = rec(s, input, m)
				if (mid > n-1) r = m
				else l = m
			}
			l
		}
	}
	println(rightP-leftP+1)
}