#!/usr/bin/env python #coding:utf8 def read(): N = int(raw_input()) L = int(raw_input()) xList = [] xList.append(0) for i in range(N - 1): xList.append(int(raw_input())) return L, xList def work((L, xList)): xList = xList[::-1] ans = 0 total = 0 for i in range(len(xList)): if i > 0: # not (xList[i ] - L / 2 < total / i < xList[i ] + L / 2) or # not (xList[i + 1] - L / 2 < total / i < xList[i + 1] + L / 2) if not (i * (2 * xList[i ] - L) < 2 * total < i * (2 * xList[i ] + L)) or \ not (i * (2 * xList[i - 1] - L) < 2 * total < i * (2 * xList[i - 1] + L)): ans += 1 if abs(xList[i - 1] - xList[i]) >= L: print -1 return total += xList[i] print ans if __name__ == "__main__": work(read())