#include <fstream.h>
#include <math.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

const long MAX = 100100;
struct {
	long pos, cnt;
} M[100];
long P, m, N, R, primes[MAX], num[MAX], res[MAX];

void Input() {
	cin >> N >> m;
}

void Add(long n, long d) {
	long s = sqrt(n) + 1;
	for (long i = 0; i < P && primes[i] <= s; i++)
		while (n % primes[i] == 0) {
			n /= primes[i];
			num[primes[i]] += d;
		}
	if (n != 1)
		num[n] += d;
}

long erat[MAX];

void Erat(){
	memset(erat, 0, sizeof erat);	
	P = 0;
	for (long i = 2; i < MAX; i++)
		if (!erat[i]){
			for (long j = i + i; j < MAX; j += i)
				erat[j] = 1;
			primes[P++] = i;
		}
}

void Solve(){
	Erat();
	memset(num, 0, sizeof num);
	Add(m, 1);
	long i, T = 0;
	for (i = 0; i < P; i++)
		if (num[primes[i]]) {
			M[T].pos = i;
			M[T].cnt = num[primes[i]];
			T++;
		}
	for (; T < 10; T++) {
		M[T].pos = 99999;
		M[T].cnt = 0;
	}
	memset(num, 0, sizeof num);
	R = 0;
	if (m == 1)
		res[R++] = 1;
	for (i = 1; i < N; i++) {
		Add(N - i, 1);
		Add(i, -1);
		long ok = 1, j;
		for (j = 0; j < 20; j++)
			if (M[j].cnt && M[j].cnt > num[primes[M[j].pos]])
				ok = 0;
		if (ok) 
			res[R++] = i + 1;
	}
}

void Output(){
	cout << R << endl;
	for (long i = 0; i < R; i++) {
		if (i)
			cout << ' ';
		cout << res[i];
	}
}

int main(){
	ifstream fi("irrelevant.in");
	ofstream fo("irrelevant.out");
	cin = fi;
	cout = fo;
	Input();
	Solve();
	Output();
	return 0;
}
