ll N,L,x,p[2d7];{rd(N,L);rep(i,2,3d3)if(!p[i])p[i*(2..1d7/i)]=1;x-=p[2..L/~-N]?0:~L+(2..)*~-N;wt(x);}