let () =
    let main () =
        let n, k = Scanf.sscanf (read_line ()) "%d %d" (fun n k -> n, k) in
        if 2 * k - 1 > n then print_endline "-1" else (
            let m1, m2 = n / 2, n - n / 2 in
            let a = Array.make n 0 in
            let b = Array.make n 0 in
            let c = Array.init n (fun i -> i + k + 2 * n) in
            for i = 0 to m2 - 1 do
                a.(i * 2) <- i + k;
                b.(i * 2) <- i + k + n + m1
            done;
            for i = 0 to m1 - 1 do
                a.(i * 2 + 1) <- i + k + m2;
                b.(i * 2 + 1) <- i + k + n
            done;
            for i = 0 to n - 1 do
                Printf.printf "%d %d %d\n" a.(i) b.(i) c.(i)
            done
        )
    in
    main ()