package yukicoder; import java.util.Scanner; public class N415 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int D=sc.nextInt(); int[] fl=new int[N]; int pyon=0; int now=0; fl[0]=1; for(int i=1;iN-1)?now+D-N:now+D]==0) { pyon++; fl[(now+D>N-1)?now+D-N:now+D]=1; now=(now+D>N-1)?now+D-N:now+D; } System.out.println(pyon); } }