#include<fstream>
#include<vector>
#include<cmath>
using namespace std;
ifstream in("irrelevant.in");
ofstream out("irrelevant.out");
int main()
{
	int n,m,i,j,k;
	vector<int> irr;
	in >> n >> m;
	double rez=1;
	for(i=0;i<n;i++)
	{
		rez=1;
		for(j=i+1, k=n-i-1;(j<=n || k>0);j++,k--)
		{
			if(j>0)
				rez*=j;
			if(k>0)
				rez/=k;
		}
		rez/=m;
		int aln=floor(rez);
		if((rez-floor(rez))<0.0000001)
		{
			irr.push_back(i+1);
		}
	}
	out << irr.size() << endl;
	for(i=0;i<irr.size();i++)
		out << irr[i] << endl;
	return 0;
}