'use strict'
function main(input) {
  input = input.trim().split('\n').shift().split(' ')
  let M = input[1] - 0
  let N = input[0] - M
  let count = 1
  count += Math.ceil(N / (M - 1))
  console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
