N = int(input())
M = int(input())
if (N//M)%1000 > 0:
    K = N//M-(N//M)%1000
    print(K)
else:
    print(N//M)