#include <stdio.h>

#define for(what) if (0) ; else for(what)

int n, m, count;
int pno, primes[40], degm[40], degc[40];
int dd[100001][40];
bool mark[100001];

int main()
{
  freopen("irrelevant.in","rt",stdin);
  freopen("irrelevant.out","wt",stdout);
  
  scanf("%d%d",&n,&m);
  n--;

  pno = 0;
  int t = m;
  while (t>1)
  {
    int p;
    for (p=2;p*p<=t;p++)
      if (!(t%p))
        break;
    if (t%p)
      p = t;
    primes[pno++] = p;
    degm[pno-1] = 0;
    while (!(t%p))
    {
      t /= p;
      degm[pno-1]++;
    }
  }

  for (int i=2;i<=n;i++)
    for (int j=0;j<pno;j++)
      if (!(i%primes[j]))
        dd[i][j] = 1+dd[i/primes[j]][j];

  for (int i=1;i<=n;i++)
  {
    mark[i] = true;
    for (int j=0;j<pno;j++)
    {
      degc[j] += (dd[n-i+1][j]-dd[i][j]);
      mark[i] &= (degc[j]>=degm[j]);
    }
    if (mark[i])
      count++;
  }

  printf("%d\n",count);
  for (int i=0;i<=n;i++)
    if (mark[i])
      printf("%d\n",i+1);

  return 0;
}