{$A+,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE GUI}
program ZadI;
{$Apptype Console}
uses
  Forms;

const
    infile='irrelevant.in';
    outfile='irrelevant.out';
    NMax=100001;

var KolAns,T,count,met,Cur,n,TMP,m,i,k,l,j:longint;
    Ans:array [0..NMax] of longint;
    Del,Kol:array [0..2*NMax] of longint;

procedure init;
begin
    assign(input,infile);
    reset(input);
    read(n,m);
    close(input);
end;

procedure GetM;
begin
    Cur:=2;
    T:=M;
    while (Cur<=Round(sqrt(M))) and (T<>1) do
    begin
        if (T mod Cur=0) then
        begin
            Inc(Count);
            Del[Count]:=Cur;
            kol[Count]:=1;
            T:=T div Cur;
        end;
        while (T mod Cur=0) do
        begin
            inc(kol[Count]);
            T:=T div Cur;
        end;
        inc(Cur);
    end;
    if (T<>1) then
    begin
      inc(count);
      kol[count]:=1;
      Del[Count]:=T;
    end;
end;

function KolA(V,K:longint):longint;
var Kol:longint;
begin
    Kol:=0;
    while (V>0) do
    begin
        V:=V div K;
        Inc(Kol,V);
    end;
    KolA:=Kol;
end;

procedure main;
begin
    GetM;
    for i:=2 to N-1 do
    begin
        met:=0;
        for j:=1 to Count do
            if (KolA(N-1,Del[j])-KolA(I-1,Del[j])-KolA(N-I,Del[j])<Kol[j]) then
            begin
                met:=1;
                break;
            end;
        if (met=0) then
        begin
            inc(KolAns);
            Ans[KolAns]:=i;
        end;
    end;
end;

procedure done;
begin
    assign(output,outfile);
    rewrite(output);
    writeln(KolAns);
    for i:=1 to KolAns do
        write(Ans[i],' ');
    close(output);
end;

begin
    init;
    main;
    done;
end.
