#!/usr/bin/env python3
import sys
import random

# Argument handling consistent with existing generators
if len(sys.argv) < 6:
    print("Usage: gen_a_equal_1.py <n> <q> <maxa> <maxk> <seed>")
    sys.exit(1)

n = int(sys.argv[1])
q = int(sys.argv[2])
maxa = int(sys.argv[3])
maxk = int(sys.argv[4])
seed = int(sys.argv[5])

random.seed(seed)

print(n, q)

# All a_i = 1 for this subtask
print(*(1 for _ in range(n)))

queries = []

# Ensure k = n twice
for _ in range(min(q, 2)):
    queries.append(n)

# Ensure k > n once
if len(queries) < q and maxk > n:
    queries.append(random.randint(n + 1, maxk))

# Ensure k < n once
if len(queries) < q and n > 1:
    queries.append(random.randint(1, n - 1))

while len(queries) < q:
    queries.append(random.randint(1, maxk))

random.shuffle(queries)

for k in queries:
    print(k)
