This is an interactive problem.

Note: the XOR-sum of an array a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9) is defined as a_1 ⊕ a_2 ⊕ … ⊕ a_n, where ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).

Little Dormi received an array of n integers a_1, a_2, …, a_n for Christmas. However, while playing with it over the winter break, he accidentally dropped it into his XOR machine, and the array got lost.

The XOR machine is currently configured with a query size of k (which you cannot change), and allows you to perform the following type of query: by giving the machine k distinct indices x_1, x_2, …, x_k, it will output a_{x_1} ⊕ a_{x_2} ⊕ … ⊕ a_{x_k}.

As Little Dormi's older brother, you would like to help him recover the XOR-sum of his array a_1, a_2, …, a_n by querying the XOR machine.

Little Dormi isn't very patient, so to be as fast as possible, you must query the XOR machine the minimum number of times to find the XOR-sum of his array. Formally, let d be the minimum number of queries needed to find the XOR-sum of any array of length n with a query size of k. Your program will be accepted if you find the correct XOR-sum in at most d queries.

Lastly, you also noticed that with certain configurations of the machine k and values of n, it may not be possible to recover the XOR-sum of Little Dormi's lost array. If that is the case, you should report it as well.

The array a_1, a_2, …, a_n is fixed before you start querying the XOR machine and does not change with the queries.

Input

The only line of input contains the integers n and k (1 ≤ n ≤ 500, 1 ≤ k ≤ n), the length of the lost array and the configured query size of the XOR machine.

Elements of the original array satisfy 1 ≤ a_i ≤ 10^9.

It can be proven that that if it is possible to recover the XOR sum under the given constraints, it can be done in at most 500 queries. That is, d ≤ 500.

After taking n and k, begin interaction.

Output

If it is impossible to recover the XOR-sum of the array, output -1 immediately after taking n and k. Do not begin interaction.

Otherwise, when your program finds the XOR-sum of the lost array a_1, a_2, …, a_n, report the answer in the following format: "! x", where x is the XOR sum of the array a_1, a_2, …, a_n, and terminate your program normally immediately after flushing the output stream. 

Note that answering does not count as a query.

Interaction

Each query is made in the format "? b", where b is an array of exactly k distinct integers from 1 to n denoting the indices of the elements in the lost array that you want to query the XOR sum of.

You will then receive an integer x, the XOR sum of the queried elements. It can be proven that 0 ≤ x ≤ 2 ⋅ 10^9 will always be true.

After printing a query do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

  * fflush(stdout) or cout.flush() in C++; 
  * System.out.flush() in Java; 
  * flush(output) in Pascal; 
  * stdout.flush() in Python; 
  * see documentation for other languages.



If at any point you make an invalid query or try to make more than 500 queries (which is the hard limit), the interaction will terminate immediately and give you a Wrong Answer verdict. Note that if you exceed d queries, the interaction will continue normally unless you also exceed the 500 query hard limit, though you will still receive a Wrong Answer verdict either way.

Hacks

To hack a solution, use the following format.

The first line contains the integers n and k (1 ≤ n ≤ 500, 1 ≤ k ≤ n).

The second line contains the the array a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9).

Examples

Input


5 3

4

0

1


Output


? 1 2 3

? 2 3 5

? 4 1 5

! 7


Input


3 2


Output


-1

Note

In the first example interaction, the array a_1, a_2, …, a_n is 2, 1, 7, 5, 6 and its XOR-sum is 7. 

The first query made asks for indices 1,2,3, so the response is a_1 ⊕ a_2 ⊕ a_3 = 2 ⊕ 1 ⊕ 7 = 4.

The second query made asks for indices 2,3,5, so the response is a_2 ⊕ a_3 ⊕ a_5 = 1 ⊕ 7 ⊕ 6 = 0.

The third query made asks for indices 4,1,5, so the response is a_4 ⊕ a_1 ⊕ a_5 = 5 ⊕ 2 ⊕ 6 = 1. Note that the indices may be output in any order.

Additionally, even though three queries were made in the example interaction, it is just meant to demonstrate the interaction format and does not necessarily represent an optimal strategy.

In the second example interaction, there is no way to recover the XOR-sum of Little Dormi's array no matter what is queried, so the program immediately outputs -1 and exits.

Difficulty: UNKNOWN_DIFFICULTY
Tags: Graph algorithms

Constructive algorithms

Shortest paths

Implementation

Complete search

Greedy algorithms

Dynamic programming

Flows and cuts
Skill types: Dynamic programming

Complete search

Greedy algorithms

Starter code:

Solutions:
from sys import stdout

def reverse(n, req):
	return [x for x in range(1, n + 1) if x not in req]

def solve():
	(n, k) = (int(x) for x in input().split())
	if n % 2 == 1 and k % 2 == 0:
		print(-1)
		stdout.flush()
		return
	elif n % k == 0:
		xor = 0
		curr_idx = 1
		while curr_idx <= n:
			next_idx = curr_idx + k
			print('?', ' '.join((str(x) for x in range(curr_idx, next_idx))))
			stdout.flush()
			xor ^= int(input())
			curr_idx = next_idx
		print('!', xor)
		stdout.flush()
		return
	elif n % 2 != k % 2 and n < 2 * k:
		xor = 0
		curr_idx = 1
		kk = n - k
		while True:
			next_idx = curr_idx + kk
			curr_arr = reverse(n, set(range(curr_idx, next_idx)))
			print('?', ' '.join((str(x) for x in curr_arr)))
			stdout.flush()
			xor ^= int(input())
			curr_idx = next_idx
			if n - curr_idx + 1 < 2 * kk and (n - curr_idx + 1) % 2 == 0:
				break
		if curr_idx < n:
			arr = list(range(1, kk + 1))
			next_idx = curr_idx + (n - curr_idx + 1) // 2
			curr_arr = list(range(curr_idx, next_idx)) + arr
			curr_arr = reverse(n, set(curr_arr[:kk]))
			print('?', ' '.join((str(x) for x in curr_arr)))
			stdout.flush()
			xor ^= int(input())
			curr_arr = list(range(next_idx, n + 1)) + arr
			curr_arr = reverse(n, set(curr_arr[:kk]))
			print('?', ' '.join((str(x) for x in curr_arr)))
			stdout.flush()
			xor ^= int(input())
		print('!', xor)
		stdout.flush()
		return
	else:
		xor = 0
		curr_idx = 1
		while True:
			next_idx = curr_idx + k
			print('?', ' '.join((str(x) for x in range(curr_idx, next_idx))))
			stdout.flush()
			xor ^= int(input())
			curr_idx = next_idx
			if n - curr_idx + 1 < 2 * k and (n - curr_idx + 1) % 2 == 0:
				break
		if curr_idx < n:
			arr = list(range(1, k + 1))
			next_idx = curr_idx + (n - curr_idx + 1) // 2
			curr_arr = list(range(curr_idx, next_idx)) + arr
			print('?', ' '.join((str(x) for x in curr_arr[:k])))
			stdout.flush()
			xor ^= int(input())
			curr_arr = list(range(next_idx, n + 1)) + arr
			print('?', ' '.join((str(x) for x in curr_arr[:k])))
			stdout.flush()
			xor ^= int(input())
		print('!', xor)
		stdout.flush()
		return
solve()


import sys
input = sys.stdin.readline
from heapq import *

def ask(lst):
	print('?', *lst, flush=True)
	return int(input())

def main():
	(n, k) = map(int, input().split())
	i = 0
	while 1:
		if i > 10 ** 6:
			print(-1)
			return
		i += 1
		if i % 2 == 1:
			max_ = i
		else:
			max_ = i - 1
		if k * i < n or (k * i - n) % 2 == 1 or n * max_ < i * k:
			continue
		else:
			break
	cnt = [1] * n
	z = k * i - n
	if i % 2 == 1:
		max_ = i
	else:
		max_ = i - 1
	for i in range(n):
		plus = min(z, max_ - 1)
		cnt[i] += plus
		z -= plus
	hq = []
	for (i, c) in enumerate(cnt, 1):
		heappush(hq, (-c, i))
	ans = 0
	while hq:
		q = []
		add = []
		for _ in range(k):
			(c, i) = heappop(hq)
			c += 1
			q.append(i)
			if c != 0:
				add.append((c, i))
		ans ^= ask(q)
		for tmp in add:
			heappush(hq, tmp)
	print('!', ans)
for _ in range(1):
	main()


from collections import deque, defaultdict
from sys import stdout

def searchPath(n, k):

	def getNexts(curr):
		lb = max(k - curr, curr - k)
		ub = min(n - max(0, k + curr - n), curr + k)
		return range(lb, ub + 1, 2)
	processed = [False for _ in range(n + 1)]
	deq = deque()
	deq.append(0)
	prev = [None for _ in range(n + 1)]
	while len(deq) > 0 and (not processed[n]):
		x = deq.popleft()
		processed[x] = True
		nexts = getNexts(x)
		for xNext in nexts:
			if not processed[xNext]:
				processed[xNext] = True
				prev[xNext] = x
				deq.append(xNext)
	if not processed[n]:
		return None
	result = []
	x = n
	while x > 0:
		result.append(x)
		x = prev[x]
	return result[::-1]

def solve(n, k):
	fullSet = set(range(1, n + 1))
	path = searchPath(n, k)
	if path is None:
		return None
	currSet = set()
	result = 0
	for length in path:
		currLen = len(currSet)
		inSet = int((currLen + k - length) / 2)
		outSet = k - inSet
		a = []
		for (i, x) in enumerate(currSet):
			if i == inSet:
				break
			a.append(x)
		currAntiSet = fullSet - currSet
		for x in a:
			currSet.remove(x)
		for (i, x) in enumerate(currAntiSet):
			if i == outSet:
				break
			a.append(x)
			currSet.add(x)
		print('?', *a)
		result = result ^ int(input())
	return result

def printResult(result):
	if result is None:
		print(-1)
	else:
		print('!', result)
t = 1
results = deque()
for _ in range(t):
	(n, k) = list(map(int, input().split(' ')))
	result = solve(n, k)
	printResult(result)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
(n, k) = mp()
if n % 2 == 1 and k % 2 == 0:
	print(-1)
	exit()
nQueries = l1d(n, 1)
sm = n
i = 0
while sm % k != 0 or max(nQueries) * k > sm:
	nQueries[i % n] += 2
	sm += 2
	i += 1
xor = 0
ansl = [[-nQueries[i], i + 1] for i in range(n)]
heapify(ansl)
while sm:
	tmp = []
	print('?', end='')
	for i in range(k):
		(f, ind) = heappop(ansl)
		tmp.append([f + 1, ind])
		print(' ' + str(ind), end='')
	print()
	stdout.flush()
	xor ^= int(inp())
	sm -= k
	for x in tmp:
		heappush(ansl, x)
print('!', xor)


import sys, os
from queue import Queue

class sim:

	def __init__(self, A):
		self.n = len(A)
		self.A = [0] + A

	def query(self, ix):
		x = 0
		for i in ix:
			x ^= self.A[i]
		print('?->', x)
		return x
if os.environ['USERNAME'] == 'kissz':
	n = 500
	k = 499
	simulator = sim([*range(500)])
	inp = simulator.query

	def debug(*args):
		print(*args, file=sys.stderr)
else:
	(n, k) = map(int, input().split())

	def inp(ix):
		print('?', *ix)
		sys.stdout.flush()
		return int(input())

	def debug(*args):
		pass
if n % 2 == 1 and k % 2 == 0:
	print(-1)
else:
	M = [(-1, -1)] * (n + 1)
	M[0] = (0, 0)
	Q = Queue()
	Q.put(0)
	while not Q.empty():
		q = Q.get()
		for i in range(max(0, q + k - n), min(q, k) + 1):
			qn = q + k - 2 * i
			if M[qn][0] < 0:
				M[qn] = (M[q][0] + 1, q)
				Q.put(qn)
	debug(M)
	L = []
	on = n
	while on != 0:
		L.append(on)
		on = M[on][1]
	L.reverse()
	debug(L)
	X = [False] * (n + 1)
	on = 0
	x = 0
	for y in L:
		o = (k - (y - on)) // 2
		p = k - o
		ix = []
		i = 1
		while p > 0 or o > 0:
			if X[i]:
				if o > 0:
					ix.append(i)
					o -= 1
			elif p > 0:
				ix.append(i)
				p -= 1
			i += 1
		for i in ix:
			X[i] = not X[i]
		x ^= inp(ix)
		on = y
	print('!', x)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
if n % 2 == 1 and k % 2 == 0:
	print(-1)
	exit()
want = [1] * n
tot = n
curr = 0
while tot % k != 0 or want[0] * k > tot:
	want[curr] += 2
	tot += 2
	curr = (curr + 1) % n
out = 0
while tot:
	poss = [(want[i], i) for i in range(n)]
	poss.sort(reverse=True)
	quer = []
	for j in range(k):
		quer.append(poss[j][1] + 1)
		want[poss[j][1]] -= 1
	tot -= k
	print('?', ' '.join(map(str, quer)))
	sys.stdout.flush()
	out ^= int(input())
print('!', out)


import sys
input = sys.stdin.readline
from operator import itemgetter
(n, k) = map(int, input().split())
if n % 2 == 1 and k % 2 == 0:
	print(-1, flush=True)
	exit()
if k == n - 1:
	ANS = 0
	for i in range(n):
		L = ['?']
		for j in range(n):
			if i == j:
				continue
			L.append(j + 1)
		print(*L, flush=True)
		ANS ^= int(input())
	print('!', ANS, flush=True)
	exit()
for i in range(n, 10 ** 9, 2):
	if i % k == 0:
		ind = 0
		X = [0] * n
		while i:
			if X[ind] == 0:
				X[ind] += 1
				i -= 1
				ind = (ind + 1) % n
			elif X[ind] >= 1:
				X[ind] += 2
				i -= 2
				ind = (ind + 1) % n
		XI = []
		for j in range(n):
			XI.append([X[j], j])
		ANS = []
		flag = 1
		for j in range(sum(X) // k):
			XI.sort(key=itemgetter(0), reverse=True)
			Y = ['?']
			for l in range(k):
				if XI[l][0] >= 1:
					XI[l][0] -= 1
					Y.append(XI[l][1] + 1)
				else:
					flag = 0
					break
			ANS.append(Y)
			if flag == 0:
				break
		if flag == 0:
			continue
		else:
			break
XX = 0
for ans in ANS:
	print(*ans, flush=True)
	XX ^= int(input())
print('!', flush=True)
print(XX, flush=True)


from heapq import heappush, heappop

def chk(i):
	return 1 + (i + N - 1) // N * 2

def arar(i):
	A = [1] * N
	j = 0
	while i:
		A[j] += 2
		j = (j + 1) % N
		i -= 1
	return A
H = []
hpush = lambda x: heappush(H, -x)
hpop = lambda : -heappop(H)
hmax = lambda : -H[0]
mmm = (1 << 20) - 1
(N, K) = map(int, input().split())
ng = 1
for i in range(300000):
	if (N + i * 2) % K == 0 and (N + i * 2) // K >= chk(i):
		ng = 0
		break
if ng:
	print(-1)
else:
	A = arar(i)
	for (i, a) in enumerate(A):
		hpush((a << 20) + i)
	ans = 0
	while H:
		L = []
		I = []
		for _ in range(K):
			ai = hpop()
			a = ai >> 20
			i = ai & mmm
			I.append(i)
			if a > 1:
				L.append((a - 1 << 20) + i)
		print('?', *sorted([a + 1 for a in I]))
		ans ^= int(input())
		for ai in L:
			hpush(ai)
	print('!', ans)


from sys import stdin, stdout
input = stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
ip = inlt()
n = ip[0]
k = ip[1]
t = n
max_n = 1
while t % k != 0 and max_n < 500:
	max_n += 2
	t = max(n * (max_n - 2) + 2, max_n * k)
	if (t + n) % 2 == 1:
		t += 1
	while t < max_n * n and t % k != 0:
		t += 2
if max_n == 501:
	print(-1)
	exit(0)
a = [max_n - 2] * n
for i in range((t - (max_n - 2) * n) // 2):
	a[i] += 2
a = [(i, a[i]) for i in range(len(a))]
ans = 0
for i in range(t // k):
	a.sort(key=lambda x: x[1], reverse=True)
	print('?', end=' ')
	for j in range(k):
		print(a[j][0] + 1, end=' ')
		a[j] = (a[j][0], a[j][1] - 1)
	print()
	stdout.flush()
	ans = ans ^ inp()
print(f'! {ans}')


import os
import random
import sys
from collections import deque
from math import inf
random.seed(0)
input = sys.stdin.buffer.readline
DEBUG = False

def solve():

	def debug(*args):
		if not DEBUG:
			return
		sys.stderr.write('\x1b[0;31m')
		print(*args, file=sys.stderr)
		sys.stderr.write('\x1b[0m')
		sys.stderr.flush()

	def query(*args):
		(arr,) = args
		assert len(arr) == K
		if DEBUG:
			xor = 0
			for i in arr:
				xor ^= A[i]
			debug('query(' + ', '.join(map(str, args)) + '):', xor)
			return xor
		os.write(1, b'? %s\n' % ' '.join((str(i + 1) for i in arr)).encode())
		result = int(input())
		return result

	def answerBad():
		os.write(1, b'-1\n')

	def answer(ans):
		if DEBUG:
			xor = 0
			for x in A:
				xor ^= x
			debug(ans, xor)
			assert ans == xor
		os.write(1, b'! %d\n' % ans)
	if DEBUG:
		N = random.randint(1, 10)
		K = random.randint(1, N)
		A = [random.randint(1, 10) for i in range(N)]
		debug(N, K, A)
	else:
		(N, K) = [int(x) for x in input().split()]
	graph = [{} for i in range(N + 1)]
	for u in range(N + 1):
		for numOff in range(min(u, K) + 1):
			numOn = K - numOff
			if u + numOn <= N:
				v = u - numOff + numOn
				assert 0 <= v <= N
				graph[u][v] = numOff
	dist = {0: 0}
	parent = {}
	q = deque([0])
	while q:
		u = q.popleft()
		d = dist[u]
		for (v, w) in graph[u].items():
			if v not in dist:
				dist[v] = d + 1
				parent[v] = u
				q.append(v)
	if N not in dist:
		answerBad()
		return
	path = [N]
	while path[-1] in parent:
		path.append(parent[path[-1]])
	path = path[::-1]
	ans = 0
	off = list(range(N))
	on = []
	for (u, v) in zip(path, path[1:]):
		numOff = graph[u][v]
		turnOff = []
		for i in range(numOff):
			turnOff.append(on.pop())
		turnOn = []
		for i in range(K - numOff):
			turnOn.append(off.pop())
		on.extend(turnOn)
		off.extend(turnOff)
		ans ^= query(turnOff + turnOn)
	answer(ans)
if DEBUG:
	for i in range(10000):
		solve()
else:
	solve()


from time import time
t0 = time()
from heapq import heappop, heappush, heapify
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
(N, K) = map(int, input().split())
Table = [1] * N
c = N
h = 1
idx = 0
while c % K != 0 or c // K < h:
	if idx == 0:
		h += 2
	Table[idx] += 2
	c += 2
	idx = (idx + 1) % N
	if time() - t0 > 1.0:
		print(-1)
		exit()
q = []
for (i, t) in enumerate(Table):
	q.append(-1000 * t - i)
heapify(q)
ans = 0
for _ in range(c // K):
	query = []
	q_out = []
	for _ in range(K):
		v = -heappop(q)
		i = v % 1000
		t = v // 1000
		query.append(i + 1)
		t -= 1
		q_out.append(-(t * 1000 + i))
	for v in q_out:
		heappush(q, v)
	print('?', ' '.join(map(str, query)))
	sys.stdout.flush()
	a = int(input())
	ans ^= a
print('!', ans)
sys.stdout.flush()


import sys
input = sys.stdin.readline

def solve():
	(n, k) = map(int, input().split())
	dp = [None] * (n + 1)
	p = [None] * (n + 1)
	dp[0] = 0
	q = [0]
	qi = 0
	while qi < len(q):
		x = q[qi]
		qi += 1
		for j in range(min(k, x) + 1):
			if x + k - j <= n:
				y = x + k - 2 * j
				if y >= 0 and y <= n and (dp[y] is None):
					dp[y] = dp[x] + 1
					p[y] = x
					q.append(y)
	if dp[n] is None:
		print(-1)
		sys.stdout.flush()
		return
	x = n
	a = [n]
	while x != 0:
		x = p[x]
		a.append(x)
	print(a, file=sys.stderr)
	res = 0
	have = [False] * n
	for i in range(len(a) - 2, -1, -1):
		x = a[i + 1]
		g = ['?']
		for j in range(min(k, x) + 1):
			y = x + k - 2 * j
			if y == a[i]:
				l = k - j
				for w in range(n):
					if have[w] == True:
						if j > 0:
							j -= 1
							g.append(str(w + 1))
							have[w] = False
					elif l > 0:
						l -= 1
						g.append(str(w + 1))
						have[w] = True
				break
		print(' '.join(g))
		sys.stdout.flush()
		res ^= int(input())
	print('!', res)
	sys.stdout.flush()
solve()


import sys
import collections
(n, k) = map(int, input().split())
if n % 2 == 1 and k % 2 == 0:
	sys.stdout.flush()
	print('-1')
else:
	q = collections.deque()
	node = n
	fin = 0
	prev = dict()
	diffs = dict()
	q.append(node)
	vis = [False] * (n + 1)
	vis[node] = True
	while len(q) > 0:
		even = q.popleft()
		if even == 0:
			break
		odd = n - even
		for i in range(max(k - odd, 0), min(even + 1, k + 1)):
			if not vis[even - i + k - i]:
				vis[even - i + k - i] = True
				prev[even - i + k - i] = even
				q.append(even - i + k - i)
				diffs[even - i + k - i] = i
	x = 0
	nums = []
	while x != n:
		nums.append(x)
		x = prev[x]
	odds = collections.deque()
	evens = collections.deque()
	for i in range(n):
		evens.append(i + 1)
	ans = 0
	for c in nums[::-1]:
		amount = diffs[c]
		query = []
		for _ in range(amount):
			t = evens.popleft()
			query.append(str(t))
			odds.append(t)
		for _ in range(k - amount):
			t = odds.popleft()
			query.append(str(t))
			evens.append(t)
		sys.stdout.flush()
		print('? ' + ' '.join(query))
		ans = ans ^ int(input())
	sys.stdout.flush()
	print('! ' + str(ans))


import os, sys
from io import BytesIO, IOBase
from math import log2, ceil, sqrt, gcd
from _collections import deque
import heapq as hp
from bisect import bisect_left, bisect_right
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7
(n, k) = map(int, input().split())
h = [[-1, i + 1] for i in range(n)]
tot = n
m = 1
i = 0
while tot <= 500 * k and (tot % k or tot < -h[0][0] * k):
	h[i][0] -= 2
	tot += 2
	i = (i + 1) % n
if tot > 500 * k:
	print(-1)
else:
	ans = 0
	while tot:
		a = [hp.heappop(h) for _ in range(k)]
		print('?', end=' ')
		for i in a:
			print(i[1], end=' ')
			i[0] += 1
			hp.heappush(h, i)
		print(flush=True)
		ans ^= int(input())
		tot -= k
	print('!', ans, flush=True)


import sys
sys.stderr = sys.stdout
from collections import deque

def queries(n, k):
	D = {}
	Q = deque()
	p = (0, n)
	D[p] = (None, None)
	Q.append(p)
	while Q:
		(a, b) = q = Q.popleft()
		if a == n:
			break
		for i in range(max(k - a, 0), min(k, b) + 1):
			d = 2 * i - k
			p = (a + d, b - d)
			if p not in D:
				D[p] = (q, i)
				Q.append(p)
	else:
		return None
	(p, i) = D[n, 0]
	L = []
	while p:
		L.append(i)
		(p, i) = D[p]
	L.reverse()
	A = deque((), n)
	B = deque(range(1, n + 1), n)
	Q = []
	for i in L:
		S = ['?']
		for _ in range(i):
			a = B.popleft()
			A.append(a)
			S.append(a)
		for _ in range(i, k):
			b = A.popleft()
			B.append(b)
			S.append(b)
		Q.append(' '.join(map(str, S)))
	assert len(A) == n
	return Q

def main():
	(n, k) = readinti()
	Q = queries(n, k)
	if Q:
		x = 0
		for q in Q:
			print(q, flush=True)
			x ^= readint()
		print(f'! {x}')
	else:
		print('-1', flush=True)

def readint():
	return int(input())

def readinti():
	return map(int, input().split())

def readintt():
	return tuple(readinti())

def readintl():
	return list(readinti())

def readinttl(k):
	return [readintt() for _ in range(k)]

def readintll(k):
	return [readintl() for _ in range(k)]

def log(*args, **kwargs):
	print(*args, **kwargs, file=sys.__stderr__)
main()