import math._ object Main { def isInvalid(L: Int, xs: Array[Int]): Boolean = { var l = 0 for (i <- 0 to xs.length-1) { if (abs(l - xs(i)) >= L) return true l = xs(i) } false } def calc(N: Int, L: Int, xs: Array[Int]): Int = { if (isInvalid(L, xs)) return -1 if (xs.isEmpty) return 0 var ans = 0 var p = (xs.last + xs.last + L) / 2.0 var cnt = 1 for (i <- xs.length-2 to 0 by -1) { var t = p / cnt if (xs(i) < t && t < xs(i) + L && xs(i+1) < t && t < xs(i+1) + L) { } else ans += 1 p += (xs(i) + xs(i) + L) / 2.0 cnt += 1 } ans } def main(args: Array[String]) { val sc = new java.util.Scanner(System.in) val N = sc.nextInt val L = sc.nextInt val xs = Array.fill(N-1)(sc.nextInt) println(calc(N, L, Array(0) ++ xs)) } }