import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long budget = scan.nextLong();
		int numOfKids = scan.nextInt();
		long handselAmount = 0;

		if(budget / numOfKids < 1000){
			handselAmount = 0;
		}else if(budget % numOfKids == 0){
			handselAmount = budget / numOfKids;
		}else{
			int handselAmountBase = 1000;

			while(handselAmount * numOfKids < budget){
				handselAmount += handselAmountBase;
			}

			handselAmount -= 1000;
		}

		System.out.println(handselAmount);
		scan.close();
	}

}