//员工数 
var m = parseInt(input.split(' ')[0]);
//console.log(m);
//大巴容量
var c = parseInt(input.split(' ')[1]);
//console.log(c);
//组数
var group = parseInt(Math.ceil(m/c));
//console.log(group);
//员工工号
var all = readline();
//console.log(all);
var arr = all.split(' ');
//console.log(arr);
//console.log(typeof(arr));
//输出字符串
var outStr='';
//倒序输出
for(var i=group-1; i>=0; i--){
    if(i==group-1){
        //最后一组可能不满c
        for(var j=i*c; j>=0&&j<m; j++){
            outStr += arr[j] + ' ';
        }
    }else{
        for(var j=i*c; j<(i+1)*c; j++){
             outStr += arr[j] + ' ';
        }
    }
}

console.log(outStr);