#include<stdio.h>

int main(){
long N,K;
scanf("%ld%ld",&N,&K);

while(N > (K/2))
{ 
  if(N>K*100){
  N /=100;
  }
  N = N - K;
  printf("%ld\n",N);
  if (N<0) N *= -1;
}

printf("%ld",N);

return 0;

}