{$APPTYPE CONSOLE}
{$O+,R-,Q-}
uses
  Sysutils, Math;
const
  inf = 1000000000;
  eps = 1e-9;
  base = 10;
type
  int = longint;
  bool = boolean;
  real = extended;

  number = record
    n: longint;
    c: array[1..1000] of int;
    p: array[1..1000] of int;
  end;

var
  i, j, k, n, m: int;
  pr: int;
  p: array[1..100001] of int;
  pp, c, mm: array[1..100001] of int;
  flag: bool;
  a: longint;
  res: int;
  ans: array[1..100000] of int;
  w: array[1..100001] of bool;
  mp: int;
  m1, c1: number;
  
begin
  assign(input, 'irrelevant.in');
  reset(input);
  assign(output, 'irrelevant.out');
  rewrite(output);
  read(n, m);
  dec(n);

  fillchar(w, sizeof(w), false);

  pr := 0;
  for i := 2 to 100000 do
  begin
    if w[i] then
    begin
      pp[i] := 0;
      continue;
    end;
    inc(pr);
    p[pr] := i;
    pp[i] := pr;

    j := 2 * i;
    while j <= 100000 do
    begin
      w[j] := true;
      j := j + i;
    end;
  end;

  for i := 1 to pr do
  begin
    c[i] := 0;
    mm[i] := 0;
  end;

  a := m;
  for i := 1 to pr do
  begin
    while (a > 1) and (a mod p[i] = 0) do
    begin
      a := a div p[i];
      inc(mm[i]);
    end;
    if a = 1 then
      break;
  end;
  if a > 1 then
  begin
    inc(pr);
    p[pr] := a;
    mm[pr] := 1;
  end;

  m1.n := 0;
  for i := 1 to pr do
  begin
    if mm[i] > 0 then
    begin
      inc(m1.n);
      m1.p[m1.n] := p[i];
      m1.c[m1.n] := mm[i];
    end;
  end;


  res := 0;

  mp := 0;

  c1.n := m1.n;
  for i := 1 to c1.n do
  begin
    c1.c[i] := 0;
    c1.p[i] := m1.p[i];
  end;

  for k := 1 to n do
  begin
    a := n - k + 1;
    for i := 1 to m1.n do
    begin
      while (a > 1) and (a mod c1.p[i] = 0) do
      begin
        a := a div c1.p[i];
        inc(c1.c[i]);
      end;
    end;
    a := k;
    for i := 1 to m1.n do
    begin
      while (a > 1) and (a mod c1.p[i] = 0) do
      begin
        a := a div c1.p[i];
        dec(c1.c[i]);
      end;
    end;
    flag := true;
    for i := 1 to m1.n do
    begin
      if c1.c[i] < m1.c[i] then
      begin
        flag := false;
        break;
      end;
    end;
    if flag then
    begin
      inc(res);
      ans[res] := k;
    end;
  end;

{  for k := 1 to n do
  begin
    a := n - k + 1;
    for i := 1 to trunc(sqrt(a)) + 1 do
    begin
      if pp[i] > 0 then
      begin
        while (a > 1) and (a mod i = 0) do
        begin
          a := a div i;
          inc(c[pp[i]]);
          if mp < pp[i] then
            mp := pp[i];
        end;
      end;
      if a = 1 then
        break;
    end;
    if a > 1 then
    begin
      inc(c[pp[a]]);
      if mp < pp[a] then
        mp := pp[a];
    end;
    a := k;
    for i := 1 to trunc(sqrt(a)) + 1 do
    begin
      if pp[i] > 0 then
      begin
        while (a > 1) and (a mod i = 0) do
        begin
          a := a div i;
          dec(c[pp[i]]);
          if (mp = pp[i]) and (c[pp[i]] = 0) then
          begin
            while (mp > 0) and (c[mp] > 0) do
              dec(mp);
          end;
        end;
      end;
      if a = 1 then
        break;
    end;
    if a > 1 then
    begin
      dec(c[pp[a]]);
      if (mp = pp[a]) and (c[pp[a]] = 0) then
      begin
        while (mp > 0) and (c[mp] > 0) do
          dec(mp);
      end;
    end;
    flag := true;
    for i := 1 to mp do
    begin
      if c[i] < mm[i] then
      begin
        flag := false;
        break;
      end;
    end;
    if flag then
    begin
      inc(res);
      ans[res] := k;
    end;
  end;
{}
  writeln(res);
  for i := 1 to res do
  begin
    write(ans[i] + 1);
    if i < res then
      write(' ');
  end;
  close(input);
  close(output);
end.
//Leafy tops of root vegetables strike back...