output_description: Print the minimum possible total cost incurred.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
      h_1 h_2 \ldots h_N
attempt:    N, K = map(int, (input().split()))
      h = list(map(int, input().split()))
  
      dp = [float("inf")] * len(h)
      dp[0] = 0
  
      for i in range(len(h)):
          for j in range(1, min(i + 1, K + 1)):
              dp[i] = min(dp[i - j] + abs(h[i] - h[i - j]), dp[i])
  
      print(dp[N - 1])
problem_description: Statement
  
  There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N),
  the height of Stone i is h_i.
  
  There is a frog who is initially on Stone 1. He will repeat the following
  action some number of times to reach Stone N:
  
    * If the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.
  
  Find the minimum possible total cost incurred before the frog reaches Stone N.
samples: [{"input": "5 3\n    10 30 40 50 20", "output": "30\n    \n\nIf we follow the path 1 \u2192 2 \u2192 5, the total cost incurred would be |10 - 30| +\n|30 - 20| = 30.\n\n* * *"}, {"input": "3 1\n    10 20 10", "output": "20\n    \n\nIf we follow the path 1 \u2192 2 \u2192 3, the total cost incurred would be |10 - 20| +\n|20 - 10| = 20.\n\n* * *"}, {"input": "2 100\n    10 10", "output": "0\n    \n\nIf we follow the path 1 \u2192 2, the total cost incurred would be |10 - 10| = 0.\n\n* * *"}, {"input": "10 4\n    40 10 20 70 80 10 20 70 80 60", "output": "40\n    \n\nIf we follow the path 1 \u2192 4 \u2192 8 \u2192 10, the total cost incurred would be |40 -\n70| + |70 - 70| + |70 - 60| = 40."}]