Let us play a game of cards. As you all know there are 52 cards in a regular deck, but our deck is somewhat different. Our deck consists of N cards. Each card simply contains a unique number from 1 to N. Initially all the cards are kept on the table, facing up. Rob, the notorious kid, flipped some of the cards, i.e. made them face down. Now, your task is to print any valid sequence of magic operations (as defined below) such that after a maximum of K magic operations, all the cards are facing upwards only.

A magic operation on card at position i consists of flipping its direction from up to down and vice versa. Also, if there exists a card on its right side, i.e. at position (i+1), that is also flipped.

Print the index of the cards that you are going to perform the magic operation on.

------ Input ------ 

Input consists of 2 lines. The first line contains 2 integers N and K, denoting the number of cards in our deck and the maximum possible number of moves allowed.

The second line contains N integers, whose absolute value lies from 1 to N. If a number is less than 0, it is initially facing down, else it is facing upwards.

It is guaranteed that all the absolute values on the cards are unique.

------ Output ------ 

Output on the first line an integer X, denoting the number of operations you intend to make for making all the cards face upwards. This integer should be less than or equal to K.

On the next line of the output, print X space separated integers, denoting the order in which you want to carry on the magic operations on any of the N cards.

Note: You have to print the index of the cards that you are going to
perform the magic operation on.

If there exist multiple solutions, output any of them

------ Constraints ------ 

1 ≤ N ≤ 1000

N ≤ K ≤ max(5000, N * N)

----- Sample Input 1 ------ 
3 4
1 2 3
----- Sample Output 1 ------ 
0
----- explanation 1 ------ 
All the cards are already facing up.

----- Sample Input 2 ------ 
5 12
4 -2 3 -1 5
----- Sample Output 2 ------ 
2
2 3
----- explanation 2 ------ 
Below sequence shows the cards after every magic operation:

t = 0,    4 -2  3 -1 5
t = 1,    4  2 -3 -1 5
t = 2,    4  2  3  1 5

Finally all the cards are now facing upwards and the number of steps are also less than k i.e. 12.

Difficulty: EASY

Starter code:

Solutions:
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = []
x = 0
for i in range(len(l)):
	if l[i] < 0:
		x += 1
		ans.append(str(i + 1))
		l[i] = -l[i]
		if i != len(l) - 1:
			l[i + 1] = -l[i + 1]
if k == []:
	print(x)
else:
	print(x, ' '.join(ans), sep='\n')


(a, b) = map(int, input().split())
c = [int(x) for x in input().split()]
ans = 0
swap = []
for i in range(a):
	if c[i] < 0:
		ans += 1
		swap.append(i + 1)
		c[i] *= -1
		if i < a - 1:
			c[i + 1] *= -1
print(ans)
print(*swap)


(n, k) = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
s = []
for j in range(n):
	if arr[j] < 0:
		arr[j] = -arr[j]
		if j != n - 1:
			arr[j + 1] = -arr[j + 1]
		s.append(j + 1)
print(len(s))
for i in range(len(s)):
	print(s[i], end=' ')


(N, K) = map(int, input().split())
C = list(map(int, input().split()))
L = []
for i in range(len(C)):
	if C[i] < 0:
		C[i] = -C[i]
		if i != N - 1:
			C[i + 1] = -C[i + 1]
		L.append(i + 1)
print(len(L))
for k in L:
	print(k, end=' ')


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = []
for i in range(len(l)):
	if l[i] < 0:
		l[i] = -l[i]
		if i != n - 1:
			l[i + 1] = -l[i + 1]
		ans.append(i)
print(len(ans))
for i in ans:
	print(i + 1, end=' ')


(x, y) = map(int, input().split())
l = list(map(int, input().split()))
nl = []
cnt = 0
for i in range(len(l)):
	if l[i] < 0:
		l[i] = l[i] * -1
		if not i == len(l) - 1:
			l[i + 1] = l[i + 1] * -1
		cnt = cnt + 1
		nl.append(i)
print(cnt)
for x in nl:
	print(x + 1, end=' ')


(n, k) = map(int, input().split())
cards = list(map(int, input().split()))
newCards = []
moves = 0
for i in range(n):
	if cards[i] < 0:
		moves += 1
		newCards.append(i + 1)
		cards[i] = -cards[i]
		if i + 1 != n:
			cards[i + 1] = -cards[i + 1]
print(moves)
for i in newCards:
	print(i, end=' ')


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
a = []
x = 0
for i in range(len(l)):
	if l[i] < 0:
		x += 1
		l[i] = -l[i]
		a.append(i + 1)
		if i != n - 1:
			l[i + 1] = -l[i + 1]
if a == []:
	print(x)
else:
	print(x)
	for i in a:
		print(i, end=' ')


def check(n):
	for i in n:
		if i < 0:
			return -1
	return 1

def flipping(FL, L, n):
	i = 0
	while i < n:
		if i == n - 1 and L[i] < 0:
			L[i] = -L[i]
			FL.append(i + 1)
			return
		if L[i] < 0:
			FL.append(i + 1)
			L[i] = -L[i]
			L[i + 1] = -L[i + 1]
			return
		i = i + 1
(n, k) = map(int, input().split())
L = list(map(int, input().strip().split()))
number = 0
FL = []
while number <= k:
	if check(L) == 1:
		print(number)
		for i in FL:
			print(i, end=' ')
		break
	else:
		flipping(FL, L, n)
		number = number + 1


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
res = []
for i in range(n):
	if l[i] < 0 and i + 1 < n:
		res.append(i + 1)
		l[i + 1] = -1 * l[i + 1]
	elif l[i] < 0 and i < n:
		res.append(i + 1)
if len(res) == 0:
	print(0)
else:
	print(len(res))
	print(*res)


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
k = []
count = 0
for i in range(len(l)):
	if l[i] < 0:
		count += 1
		k.append(str(i + 1))
		l[i] = -l[i]
		if i != len(l) - 1:
			l[i + 1] = -l[i + 1]
if k == []:
	print(count)
else:
	print(count, ' '.join(k), sep='\n')


(nk, count) = (list(map(int, input().split())), 0)
cards = list(map(int, input().split()))
neg = []
for j in range(len(cards)):
	if cards[j] < 0:
		neg.append(str(j + 1))
		count += 1
		cards[j] = cards[j] * -1
		if j != len(cards) - 1:
			cards[j + 1] = cards[j + 1] * -1
if neg == []:
	print(0)
else:
	print(count, ' '.join(neg), sep='\n')


def func(l, n, k, c=0):
	d = []
	for i in range(n):
		if c == k:
			break
		elif l[i] < 0:
			if l[i] != l[-1]:
				l[i + 1] = -l[i + 1]
			l[i] = -l[i]
			c += 1
			d.append(str(i + 1))
	return (c, d)
from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
(*l,) = map(int, stdin.readline().split())
(a, b) = func(l, n, k)
stdout.write(f'{a}\n' + ' '.join(b))


def func(l, n, k, c=1):
	d = [0, []]
	for i in range(n):
		if d[0] == k:
			break
		elif l[i] < 0:
			if l[i] != l[-1]:
				l[i + 1] = -l[i + 1]
			l[i] = -l[i]
			d[0] += 1
			d[1].append(str(i + 1))
	return d
from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
(*l,) = map(int, stdin.readline().split())
if all((True if x > 0 else False for x in l)):
	stdout.write(f'0\n')
else:
	s = func(l, n, k)
	stdout.write(f'{s[0]}\n' + ' '.join(s[1]))


def flip(lst, i):
	lst[i] = -lst[i]
	if lst[i] != lst[-1]:
		lst[i + 1] = -lst[i + 1]
	return lst
(n, k) = input().split(' ')
n = int(n)
k = int(k)
temp = input().split(' ')
lst = [int(x) for x in temp]
count = 0
store = []
for i in range(n):
	if count == k:
		break
	if lst[i] < 0:
		store.append(i + 1)
		lst = flip(lst, i)
		count += 1
print(count)
print(*store)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
last_changed = -2
ans = []
for j in range(n):
	if arr[j] < 0 and last_changed + 1 != j:
		ans.append(j + 1)
		last_changed = j
	if arr[j] > 0 and last_changed + 1 == j:
		ans.append(j + 1)
		last_changed = j
print(len(ans))
if len(ans) > 0:
	print(*ans)


(n, k) = map(int, input().split())
inp = list(map(int, input().split()))
ans = []
flips = 0
for i in range(n):
	if inp[i] < 0 and i != n - 1:
		inp[i] = inp[i] * -1
		ans.append(i + 1)
		inp[i + 1] = inp[i + 1] * -1
		flips += 1
	elif inp[i] < 0 and i == n - 1:
		inp[i] = inp[i] * -1
		ans.append(i + 1)
		flips += 1
print(flips)
print(*ans)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
B = []
S = 0
for i in range(len(A)):
	if A[i] < 0:
		A[i] = abs(A[i])
		S += 1
		B.append(i + 1)
		if i == len(A) - 1:
			break
		A[i + 1] = -A[i + 1]
print(S)
print(*B)


(n, k) = map(int, input().split())
c_list = list(map(int, input().split()))
flip_c = 0
index = []
for i in range(n - 1):
	if c_list[i] < 0:
		c_list[i] = -1 * c_list[i]
		if i + 1 < n:
			c_list[i + 1] = -1 * c_list[i + 1]
		flip_c += 1
		index.append(i + 1)
if c_list[-1] < 0:
	c_list[-1] *= -1
	index.append(n)
	flip_c += 1
print(flip_c)
if index != []:
	print(*index)


(A, B) = map(int, input().split())
L = list(map(int, input().split()))
(S1, L1) = (sum([abs(i) for i in L]), [])
c = 0
if S1 == sum(L):
	print(0)
else:
	for i in range(A - 1):
		if L[i] < 0:
			c += 1
			L1.append(i + 1)
			L[i] = abs(L[i])
			L[i + 1] *= -1
		if S1 == sum(L):
			break
	else:
		if L[-1] < 0:
			L1.append(A)
			c += 1
	print(c)
	print(*L1)


(N, K) = map(int, input().split())
L = list(map(int, input().split()))
(S1, L1) = (sum([abs(i) for i in L]), [])
C = 0
if S1 == sum(L):
	print(0)
else:
	for i in range(N - 1):
		if L[i] < 0:
			C += 1
			L1.append(i + 1)
			L[i] = abs(L[i])
			L[i + 1] *= -1
		if S1 == sum(L):
			break
	else:
		if L[-1] < 0:
			L1.append(N)
			C += 1
	print(C)
	print(*L1)


(n, b) = map(int, input().split())
l = list(map(int, input().split()))
(s1, l1) = (sum([abs(i) for i in l]), [])
c = 0
if s1 == sum(l):
	print(0)
else:
	for i in range(n - 1):
		if l[i] < 0:
			c += 1
			l1.append(i + 1)
			l[i] = abs(l[i])
			l[i + 1] *= -1
		if s1 == sum(l):
			break
	else:
		if l[-1] < 0:
			l1.append(n)
			c += 1
	print(c)
	print(*l1)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
lis = []
for i in arr:
	if i < 0:
		lis.append(arr.index(i) + 1)
lis1 = []
if len(lis) % 2:
	lis.append(n + 1)
while lis:
	for j in range(lis[0], lis[1]):
		lis1.append(j)
	lis.pop(0)
	lis.pop(0)
print(len(lis1))
print(*lis1)


(g, h) = [int(i) for i in input().split()]
s1 = [int(m) for m in input().split()]
c = 0
s2 = []
for x in range(0, len(s1) - 1):
	if s1[x] <= 0:
		c += 1
		s1.insert(x, -1 * s1[x])
		s1.pop(x + 1)
		s1.insert(x + 1, -1 * s1[x + 1])
		s1.pop(x + 2)
		s2.append(x + 1)
if s1[-1] <= 0:
	print(c + 1)
	s2.append(len(s1))
	for t in s2:
		print(t, end=' ', sep=' ')
else:
	print(c)
	for t in s2:
		print(t, end=' ', sep=' ')


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
c = []
count = 0
for j in range(len(l) - 1):
	if l[j] < 0:
		l[j] = l[j] * -1
		l[j + 1] = l[j + 1] * -1
		c.append(j + 1)
		count = count + 1
if l[a - 1] < 0:
	count = count + 1
	c.append(a)
print(count)
if len(c) > 0:
	for i in range(len(c)):
		if i < len(c) - 1:
			print(c[i], end=' ')
		else:
			print(c[i])


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
sum1 = 0
temp = []
for i in range(n):
	if a[i] >= 0:
		sum1 = sum1 * 1
	if a[i] < 0:
		if i == n - 1:
			a[i] = a[i] * -1
			temp.append(n)
			sum1 += 1
		else:
			a[i] = abs(a[i])
			a[i + 1] = -a[i + 1]
			temp.append(i + 1)
			sum1 += 1
print(sum1)
print(' '.join((str(i) for i in temp)))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = 0
s = []
for i in range(0, n):
	if a[i] >= 0:
		c *= 1
	elif i == n - 1:
		a[i] = a[i] * -1
		c += 1
		s.append(n)
	else:
		a[i] = a[i] * -1
		a[i + 1] = a[i + 1] * -1
		c += 1
		s.append(i + 1)
print(c)
for i in s:
	print(i, end=' ')


(n, k) = [int(i) for i in input().split()]
l1 = [int(m) for m in input().split()]
c = 0
l2 = []
for x in range(0, len(l1) - 1):
	if l1[x] <= 0:
		c += 1
		l1.insert(x, -1 * l1[x])
		l1.pop(x + 1)
		l1.insert(x + 1, -1 * l1[x + 1])
		l1.pop(x + 2)
		l2.append(x + 1)
if l1[-1] <= 0:
	print(c + 1)
	l2.append(len(l1))
	for t in l2:
		print(t, end=' ', sep=' ')
else:
	print(c)
	for t in l2:
		print(t, end=' ', sep=' ')


(totalNumbers, totalMoves) = map(int, input().split(' '))
numberList = list(map(int, input().split(' ')))
rev = []
result = []
swaps = 0
for i in range(0, totalNumbers):
	if numberList[i] < 0:
		rev.append(i)
if len(rev) == 0:
	print('0')
while len(rev) > 0:
	for i in range(0, totalNumbers):
		if numberList[i] < 0:
			numberList[i] *= -1
			result.append(i + 1)
			rev.remove(i)
			swaps += 1
			if i < totalNumbers - 1:
				numberList[i + 1] *= -1
				if numberList[i + 1] < 0 and i + 1 not in rev:
					rev.append(i + 1)
				elif numberList[i + 1] > 0 and i + 1 in rev:
					rev.remove(i + 1)
print(swaps)
for i in result:
	print(i, end=' ')


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
count = 0
index = []
for i in range(n):
	if a[i] >= 0:
		count *= 1
	elif i == n - 1:
		a[i] = a[i] * -1
		count += 1
		index.append(n)
	else:
		a[i] = a[i] * -1
		a[i + 1] = a[i + 1] * -1
		count += 1
		index.append(i + 1)
print(count)
for i in index:
	print(i, end=' ')


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
p = 0
index = []
for i in range(n):
	if l[i] < 0 and i + 1 < n:
		if l[i + 1] < 0:
			l[i + 1] = 1
		else:
			l[i + 1] = -1
		index.append(i + 1)
		p += 1
	elif l[i] < 0:
		index.append(i + 1)
		p += 1
print(p)
for i in index:
	print(i, end=' ')


val = [int(i) for i in input().split()]
n = val[0]
k = val[1]
arr = [int(i) for i in input().split()]
list1 = []
for i in arr:
	if i < 0:
		list1.append(0)
	else:
		list1.append(1)
ans = 0
index = []
for i in range(0, len(list1)):
	if list1[i] == 0 and i != len(list1) - 1:
		ans = ans + 1
		if list1[i + 1] == 0:
			list1[i + 1] = 1
		else:
			list1[i + 1] = 0
		index.append(i + 1)
	elif list1[i] == 0 and i == len(list1) - 1:
		ans = ans + 1
		index.append(i + 1)
print(ans)
print(*index, sep=' ')


def run_script():
	_ = input()
	num_str_lst = input().split(' ')
	num_lst = [int(_s) for _s in num_str_lst]
	pos_lst = []
	for _idx in range(len(num_lst) - 1):
		if num_lst[_idx] < 0:
			pos_lst.append(_idx + 1)
			num_lst[_idx + 1] *= -1
	if num_lst[-1] < 0:
		pos_lst.append(_idx + 2)
	print(len(pos_lst))
	print(*pos_lst)
run_script()


(n, k) = map(int, input().split(' '))
nums = list(map(int, input().split(' ')))
ans_list = []
for i in range(n):
	if nums[i] < 0:
		nums[i] *= -1
		ans_list.append(i + 1)
		if i != n - 1:
			nums[i + 1] *= -1
print(len(ans_list))
for i in ans_list:
	print(i, end=' ')


l = input().split()
n = int(l[0])
k = int(l[1])
l = input().split()
li = [int(i) for i in l]
arr = [0 for i in range(n)]
for i in range(n):
	if li[i] < 0:
		arr[i] = 1
count = 0
moves = []
for i in range(n - 1):
	if arr[i]:
		arr[i] = 0
		count += 1
		if arr[i + 1]:
			arr[i + 1] = 0
		else:
			arr[i + 1] = 1
		moves.append(i + 1)
if arr[n - 1] == 1:
	count += 1
	moves.append(n)
print(count)
for i in moves:
	print(i, end=' ')


(n, k) = map(int, input().split())
c = 0
g = []
l = list(map(int, input().split()))
for i in range(n - 1):
	if l[i] < 0:
		l[i] = -l[i]
		l[i + 1] = -l[i + 1]
		c += 1
		g.append(i + 1)
if l[-1] < 0:
	c += 1
	g.append(n)
print(c)
for i in g:
	print(i, end=' ')


(n, k) = map(int, input().split())
s = [int(x) for x in input().split()]
l = []
temp = 0
flag = 0
for i in range(0, len(s) - 1):
	if s[i] < 0:
		s[i] = -s[i]
		s[i + 1] = -s[i + 1]
		temp = temp + 1
		l.append(i + 1)
if s[-1] < 0:
	temp = temp + 1
	l.append(n)
print(temp)
for i in range(0, len(l)):
	print(l[i], end=' ')