public class TreeReplant {     public static void main(String[] args) {         Scanner scanner = new Scanner(System.in);         //胡杨总数         int n = scanner.nextInt();         //死亡胡杨数目         int m = scanner.nextInt();         //死亡胡杨编号数组         List<Integer> array = new ArrayList<>();         for (int i=0;i<m;i++) {             array.add(scanner.nextInt());         }         //补种数量         int k = scanner.nextInt();         //记录最大值         int max = 0;         //从左向右移动滑动窗口,这里的i标记的是窗口的左边界         for (int i=0;i<=m-k;i++) {             if (i == 0) {                 //滑动窗口在数组最左边                 max = Math.max(max, array.get(i+k) - 1);             }else if (i == m-k) {                 //滑动窗口在数组最右边                 max = Math.max(max, n - array.get(i-1));             }else {                 //滑动窗口在数组中间某个位置                 max = Math.max(max, array.get(i+k) - array.get(i-1) - 1);             }         }         System.out.println(max);     } }