public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int a[] = new int[n];
        int diff[]=new int[n];
        int sum=0;
        HashMap<Integer,Integer> map=new HashMap<Integer,Integer>(n);
        
        for(int a_i=0; a_i < n; a_i++){
            a[a_i] = in.nextInt();
        }
        
//        diff=diffArray(a, k);
//        
//        for(int i=0;i<n;i++){
//        	if(!map.containsKey(diff[i])){
//        		map.put(diff[i],freq(a,diff[i]));
//        	}
//        }
        
        for(Integer i:map.keySet()){
        		sum=sum+(Integer) map.get(i);
        }
        sum=0;
        //System.out.println("Sum is"+sum);
        
        ArrayList list=createComboSum(a);
       // System.out.println("size of c"+list.size());
        for(int c=0; c<list.size();c++){
        	System.out.println(list.get(c));
        	if(c%k==0){
        		sum=sum+1;
        	}
        	
        }
        //System.out.println(sum);
    }