import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int L = sc.nextInt(); int[] minX = new int[N];// 上から順に0,1,2,...と振る int[] maxX = new int[N]; double[] G = new double[N-1]; int count_glue = 0; boolean flag = false; minX[N-1] = 0; maxX[N-1] = L; for(int i=N-2;i>=0;i--){ minX[i] = sc.nextInt(); maxX[i] = minX[i]+L; if(minX[i+1] >= maxX[i] || maxX[i+1] <= minX[i])flag = true; } sc.close(); if(flag)System.out.println(-1); else{ double sum = 0; for(int i=0;i= maxX[i+1] || G[i] <= minX[i] || G[i] >= maxX[i]; if(notfixed){ count_glue++; } } System.out.println(count_glue); } } }