import java.util.Scanner

import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val K = sc.nextInt

//    val r = new ArrayBuffer[(Int, Int, Int)]()
    var result = 0
    var i = 1
    while (i <= N) {
      var j = K - i
      while (j < 1) j += K
      while (j <= N) {
        var k = K - j
        while (k < 1) k += K
        while (k <= N) {
          if ((i + k) % K == 0) {
//            r.append((i, j, k))
            result += 1
          }
          k += K
        }
        j += K
      }
      i += 1
    }

//    r.foreach(println)
    result.toString
  }
}
