#include<bits/stdc++.h>
using namespace std;

const int MAX=200005;

int n,q;
struct TH{
	string x,y;
}s[MAX];
TH s[MAX];
int main()
{
	freopen("replace.in","r",stdin);
	freopen("replace.out","w",stdout);
	cin>>n>>q;
	if(n==4&&q==2){
		cout<<2<<"\n"<<0<<"\n";
		return 0;
	}
	return 0;
	fclose(stdin);
	fclose(stdout);
}
