($n,$k)=glob<>; if($k==0){ print"-1"; exit; } for(1..$n){ for(1..$n){ print-$k--%$n**2+1,$_<$n?$":$/; } }