#!/usr/bin/env perl use strict; use warnings; my ($n, $k) = split/ /,<>; chomp $k; my @base = (-1, -3, -2, -4); my @array; for (1..(int($n/4)+3)) { push @array, @base; } for (1..$k) { unshift @array, -1; } for (0..($n-1)) { if ($_) { print " "; } print $array[$_]; } print "\n";