eolymp
bolt
Try our new interface for solving problems
Problems

Combinations 1

Combinations 1

Given positive integers n and k, print all binary sequences of length n that contains exactly k ones in lexicographical order.

Input

Two positive integers n and k (n1, 0kn).

Output

Print each binary sequence on a separate line. The digits in the sequence must be separated by a single space.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4 2
Output example #1
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0