import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int [] arr = new int[n]; for(int i=0;i=arr.length){ return 0; } long ans =Integer.MAX_VALUE; for(int a=i;a<=Math.min(arr.length-1,i+k);a++){ ans = Math.min(arr[a]+solve(arr,n,k,a+k+1),ans); } return ans; } }