import java.io.*; import java.util.*; import java.math.*; class Main128 { public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(br.readLine()); long m = Long.parseLong(br.readLine()); long d = n / m; System.out.println(d - (d % 1000)); } }