{$apptype console}
{ $q+,r+,o-}
{$q+,r+,o+}
{ $q-,r-,o+}

uses
  math, sysutils;

type
  int = longint;
  bool = boolean;
  float = extended;

const
  fn = 'irrelevant';
  maxs = 35;
  maxr = 100005;
  maxn = 100005;

var
  s: array[1..maxs] of integer;
  ms: array[1..maxs] of integer;
  m, n, sc: integer;

  res: array[1..maxn] of integer;
  rc: integer;

  fm: array[1..maxs, 0..maxn] of integer;

procedure tosimples;
var
  t, i: integer;
begin
  fillchar( ms, sizeof( ms ), 0 );
  t := m;
  sc := 0;
  for i := 2 to trunc( sqrt( m ) ) do begin
    if ( t mod i = 0 ) then begin
      inc( sc );
      s[sc] := i;
      while ( t mod i = 0 ) do begin
        inc( ms[sc] );
        t := t div i;
      end;
    end;
  end;
  if ( t <> 1 ) then begin
    inc( sc );
    s[sc] := t;
    ms[sc] := 1;
  end;
end;

var
  v: array[1..maxs] of integer;

procedure precalc;
var
  i, j: integer;
begin
  for i := 1 to sc do begin
    fm[i, 0] := 0;
    for j := 0 to n - 1 do
      fm[i, j] := ( j div s[i] ) + fm[i, j div s[i]];
  end;
end;

function check( k, n: integer ): boolean;
var
  i: integer;
begin
  for i := 1 to sc do
    v[i] := fm[i, n] - fm[i, n-k] - fm[i, k];

  check := false;
  for i := 1 to sc do
    if ( v[i] < ms[i] ) then exit;
  check := true;
end;

procedure solve;
var
  i: integer;
begin
  read( n, m );
  tosimples;
  precalc;
  
  rc := 0;
  for i := 0 to n - 1 do begin
    if ( check( i, n - 1 ) ) then begin
      inc( rc );
      res[rc] := i + 1;
    end;
  end;

  writeln( rc );
  for i := 1 to rc do
    write( res[i], ' ' );
end;

begin
  reset(input, fn + '.in');
  rewrite(output, fn + '.out');

  solve;
end.
