program i;

{$APPTYPE CONSOLE}
{$R+,Q+,S+,H+}

uses
  Math,
  SysUtils;

Type
  Integer=LongInt;
  Real=Extended;

Const
  TaskID='irrelevant';
  InFile=TaskID+'.in';
  OutFile=TaskID+'.out';
  MaxP=30;
  MaxN=100002;

Var
  N,M:Integer;
  NP:Integer;
  NIrr:Integer;
  CQ,P,Q:Array[1..MaxP]Of Integer;
  Irr:Array[0..MaxN]Of Boolean;

Procedure Load;
Begin
  ReSet(Input,InFile);
  Read(N,M);
  Dec(N);
  Close(Input);
End;

Procedure Solve;
Var
  I,J,By:Integer;
  Ok:Boolean;
Begin
  NP:=0;
  I:=2;
  While I*I<=M Do Begin
    If M Mod I=0 Then Begin
      Inc(NP);
      P[NP]:=I;
      Q[NP]:=0;
      While M Mod I=0 Do Begin
        M:=M Div I;
        Inc(Q[NP]);
      End;
    End;
    Inc(I);
  End;
  If M>1 Then Begin
    Inc(NP);
    P[NP]:=M;
    Q[NP]:=1;
  End;
  FillChar(CQ,SizeOf(CQ),0);
  FillChar(Irr,SizeOf(Irr),False);
  NIrr:=0;
  For I:=1 To N Do Begin
    By:=N-I+1;
    For J:=1 To NP Do While By Mod P[J]=0 Do Begin
      By:=By Div P[J];
      Inc(CQ[J]);
    End;
    By:=I;
    For J:=1 To NP Do While By Mod P[J]=0 Do Begin
      By:=By Div P[J];
      Dec(CQ[J]);
    End;
    Ok:=True;
    For J:=1 To NP Do If CQ[J]<Q[J] Then Ok:=False;
    Irr[I]:=Ok;
    If Ok Then Inc(NIrr);
  End;
End;

Procedure Save;
Var
  I:Integer;
  First:Boolean;
Begin
  ReWrite(Output,OutFile);
  WriteLn(NIrr);
  First:=True;
  For I:=0 To N Do If Irr[I] Then Begin
    If First Then First:=False Else Write(' ');
    Write(I+1);
  End;
  WriteLn;
  Close(Output);
End;

begin
  Load;
  Solve;
  Save;
end.
 