import std.stdio, std.conv, std.string, std.range, std.math, std.algorithm; void main() { auto W = readln.strip.to!int; auto D = readln.strip.to!int; int work = W; foreach_reverse (d; 2 .. D + 1) { work -= work / d ^^ 2; } work.writeln; }