import sequtils,strutils
var
    N = stdin.readline.parseBiggestInt
    M = stdin.readline.parseBiggestInt
    ans = N div M
ans -= ans mod 1000
echo ans