# -*- coding: utf-8 -*- N = int(input()) L = int(input()) if N == 1: print(0) exit() X = [None] * N X[0] = 0 for i in range(1, N): X[i] = int(input()) numer = 0 denom = 0 ans = N-1 for i in range(N-2, 0-1, -1): if abs(X[i+1] - X[i]) >= L: print(-1) exit() numer += X[i+1] denom += 1 if X[i] < numer/denom + L/2 < X[i] + L and X[i+1] < numer/denom + L/2 < X[i+1] + L: ans -= 1 print(ans)