unittest
{
	assert( [ "3 2" ].parse.expand.solve == 9 );
	assert( [ "5 3" ].parse.expand.solve == 1 );
	assert( [ "31415 9265" ].parse.expand.solve == 27 );
	assert( [ "35897 932" ].parse.expand.solve == 114191 );
}



import std.conv;
import std.functional;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nk = input.front.split.to!( long[] );
	return tuple( nk[ 0 ], nk[ 1 ] );
}

auto solve( long n, long k )
{
	auto r = 0L;
	
	for( auto a = 1; a <= n; a++ )
	{
		auto aa = k - a % k;
		
		for( auto b = aa; b <= n; b += k )
		{
			if( a % k != b % k ) continue;		// 余りが同じじゃないとcではkの倍数に揃えられない
			
			r += memoize!solve2( n, k, aa );
		}
	}
	
	return r;
}

auto solve2( long n, long k, long ci )
{
	auto r = 0L;
	
	for( auto c = ci; c <= n; c += k )
	{
		r++;
	}
	
	return r;
}
