Under construction

Still being built. Things may change

Lulu and the Star Guardians

Time limit1sMemory limit1024 MB

Summary
Split guardians numbered 1 to N into teams of K so that no team's power sum is divisible by K, or report NO if that is impossible.
Level

Medium6 of 10

Topics
Math, Greedy, Implementation
Solved
No attempts yet

Problem

Lulu is in charge of guarding the stars of the universe, and she has selected NN new star guardians to share her work. The combat power PiP_i of the ii-th new guardian is ii.

Lulu wants to form NK\frac{N}{K} teams, each with exactly KK new guardians, so that every new guardian is in a team. Each team is assigned to one star. NN is divisible by KK. When assigning teams to stars, follow this rule.

If the sum of the combat powers of the guardians assigned to the same star is divisible by KK, the star starts to collapse!

Help Lulu, who is weak at math, by finding how to assign the guardians so that no star collapses.

Input

The first line contains two integers NN and KK, separated by a space. NN is divisible by KK. (1≤N,K≤1 000 000)(1 \leq N, K \leq 1\,000\,000)

Output

On the first line, print YES if every guardian can be assigned so that no star collapses. Otherwise, print NO.

If such an assignment exists, print one valid assignment on the next NK\frac{N}{K} lines. Each line contains the numbers of the KK guardians assigned to the same star, separated by spaces.

Examples1

  1. Example 1

    Input
    6 3
    
    Expected output
    YES
    1 4 3
    2 5 6