#include<bits/stdc++.h>
using namespace std;
int n,k,x,res=0;
inline void query(int l,int r){
vector<int> b;
int m=r-l+1,lef=k-m>>1,x;
for(int i=1;lef&&i<l;++i) b.push_back(i),--lef;
for(int i=r+1;i<=n&&lef;++i) b.push_back(i),--lef;
cout << "? ";
for(auto i:b) cout << i << ' ';
for(int i=l;i<l+m>>1;++i) cout << i << ' ';
cout << endl;
cin >> x,res^=x;
cout << "? ";
for(auto i:b) cout << i << ' ';
for(int i=l+m>>1;i<=r;++i) cout << i << ' ';
cout << endl;
cin >> x,res^=x;
}
bool check(int i,int mx){
if((n%k)&1)return n-i+1>2*k;
return !((n-i+1<=mx)&&(!((n-i+1)&1)));
}
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin >> n >> k;
if((n&1)&&(!(k&1))){cout << "-1" << endl;return 0;}
int i,mx=2*min(k,n-k);
for(i=1;check(i,mx);i+=k){
cout << "? ";
for(int j=i;j<i+k;++j) cout << j << ' ';
cout << endl;
cin >> x;res^=x;
}
while(i<=n&&n-i+1>=mx) query(i,i+mx-1),i+=mx;
if(i<=n) query(i,n);
cout << "! " << res << endl;
return 0;
}
rt.据说是哪里少了endl但我实在没看出来,有没有大佬能帮个忙