program taskB;

{$APPTYPE CONSOLE}

uses
  SysUtils;
const
  max = 100000;
  maxcoef = 1000;

var
  primes : array[1..MAX] of longint;
  nPrimes : longint;

procedure init;
var
  i, j : longint;
  b : boolean;
begin
  for i:=1 to MAX do
    primes[i]:=0;

  nPrimes := 2;

  primes[1] := 1;
  primes[2] := 2;

  for i:=3 to round(sqrt(MAX)) do begin
    b := true;
    for j:=2 to round(sqrt(i)) do begin
      if (i mod primes[j] = 0) then begin
        b := false;
        break;
      end;
    end;

    if b then begin
        inc(nPrimes);
        primes[nPrimes] := i;
    end;
  end;

end;

var
  N, M, i, j, k,cur : longint;
  cnk, start : array[1..maxcoef] of integer;

  ok : boolean;

  arr : array[1..max] of integer;
  narr : integer;


begin
 assign( input, 'irrelevant.in' );
  assign( output, 'irrelevant.out' );
 reset(input);
  rewrite(output);

  init;

  readln(N, M);

  narr := 0;

  for i:=1 to maxcoef do
     start[i] := 0;

  cur := M;

  for j:=2 to nprimes do begin
    while (cur > 1) and (cur mod primes[j] = 0) do begin
      dec(start[j]);
      cur := cur div primes[j];
    end;
  end;

  for k:=1 to N-2 do begin

    for i:=1 to maxcoef do
        cnk[i] := start[i];

    for i:=k+1 to N-1 do begin
      cur := i;
      for j:=2 to nprimes do begin
        while (cur > 1) and (cur mod primes[j] = 0) do begin
          inc(cnk[j]);
          cur := cur div primes[j];
        end;
      end;
    end;

    for i:=0 to N-k-1 do begin
      cur := i;
      for j:=2 to nprimes do begin
        while (cur > 1) and (cur mod primes[j] = 0) do begin
          dec(cnk[j]);
          cur := cur div primes[j];
          if cur = 1 then cur := 0;
        end;
      end;
    end;

    ok := true;

    for i:=1 to maxcoef do
      if cnk[i] < 0 then begin
        ok := false;
        break;
      end;

    if ok then begin
      inc(narr);
      arr[narr] := k;
    end;
  end;

  ok := false;

  writeln(narr);

  for i:=1 to narr do begin
    if not ok then begin
      write( arr[i]+1 );
      ok := true
    end
    else
      write( ' ', arr[i]+1 );
  end;



  close(input);
  close(output);
end.

