{$I-,Q-,R-,S-}
program Project1;

{$APPTYPE CONSOLE}

Var
        n, M : LongInt;
        AM, BM : Array[1..100] Of LongInt;
        A, B, Otv : Array[1..100001] Of LongInt;
        Kol, KolOtv : LongInt;

Procedure InputData;
Begin
        Assign(input, 'irrelevant.in');
        Reset(input);
        Read(N, m);
        Close(input);
End;

Procedure OutputData;
Var
        i : LongInt;
Begin
        Assign(Output, 'irrelevant.out');
        Rewrite(output);
        Writeln(KolOtv);
        For i:= 1 To KolOtv-1 Do
                Write(Otv[i], ' ');
        If Kolotv > 0 Then
                WriteLn(Otv[KolOtv]);
        Close(Output);
End;

Procedure RasklM;

Var
        m1, i : LongInt;
        
Begin
        M1:= M;
        Kol:= 0;
        For i:= 2 To Trunc(Sqrt(M))+1 Do
        Begin
             If M1 Mod i = 0 Then
             Begin
                Inc(Kol);
                AM[Kol]:= i;
                While M1 Mod i = 0 Do
                Begin
                        Inc(BM[Kol]);
                        M1:= M1 Div i;
                End;
             End;
        End;
        If M1 <> 1 Then
        begin
                If M1 > 100000 Then
                        OutputData Else
                Begin
                        Inc(Kol);
                        AM[Kol]:= M1;
                        BM[Kol]:= 1;
                End;
        End;
End;

Procedure Solve;

Var
        i, c, j,p  : LongInt;
        Fl : Boolean;
Begin
        KolOtv:= 0;
        RasklM;
         n:= N-1;
        FillChar(A, SizeOf(A), 0);
        For i:= 1 To N-1 Do
        Begin
                c:= n-i+1;
                For j:= 2 To Trunc(Sqrt(n-i+1))+1 Do
                Begin
                        While c mod j = 0 Do
                        Begin
                                c:= c Div j;
                                Inc(A[j]);
                        End;
                End;
                If c <> 1 Then
                 Inc(A[c]);


                c:= i;
                For j:= 2 To Trunc(Sqrt(i))+1 Do
                Begin
                        While c mod j = 0 Do
                        Begin
                                c:= c Div j;
                                Dec(A[j]);
                        End;
                End;
                If c <> 1 Then
                 Dec(A[c]);

                Fl:= True;
                For p:= 1 To Kol Do
                 If BM[p] > A[AM[p]] Then
                  Fl:= False;
                If Fl Then
                Begin
                        Inc(KolOtv);
                        Otv[KolOtv]:= i+1;
                End;
        End;
End;

begin
  InputData;
  Solve;
  OutputData;
end.
