#include <fstream.h>

long mas[100000];

int main()
{
	ifstream in("irrelevant.in");
	ofstream out("irrelevant.out");
	int n, m;
	in>>n>>m;
	
	long k=0; long i;
	
	for (i=1;i<=n/2;i++)
		if (i%m==0)
		{mas[k]=i; k++;}

	if (n%2==0)
	{
		for (i=n/2;i<=n;i++)
		if ((n-i)%m==0)
		{mas[k]=i; k++;}
	}
	else
	{
		if ((n/2+1)%m==0) {mas[k]=i; k++;}

		for (i=n/2+2;i<=n;i++)
		if ((n-i+1)%m==0)
		{mas[k]=i; k++;}
	
	}

	out<<k<<endl;
	for (i = 0; i<k-1;i++)
		out<<mas[i]<<" ";
	out<<mas[k-1];




	return 0;
}