Under construction

Still being built. Things may change

Leapcow

Interview

Time limit1sMemory limit1024 MB

Summary
Find the fewest leaps of length 1 to L needed to go from 0 to E on a number line without landing on any of the buried cow positions.
Level

Easy3 of 10

Topics
Dynamic programming, Array
Solved
No attempts yet

Problem

Cows like to bury each other in sand at the beach. On this beach, cows are buried only at integer coordinates of a one-dimensional number line. Bessie wants to travel from one end of the beach (coordinate 0) to the other end (coordinate EE) without stepping on any buried cow.

5≤E≤40,0005 \le E \le 40{,}000

Bessie travels only by leaps, and each leap has a length from 1 to LL.

3≤L≤503 \le L \le 50

You are given the locations (from 1 to E−1E-1) of the BB buried cows, where 1≤B≤5001 \le B \le 500. Find the least number of leaps Bessie needs to get from one end to the other. An answer is guaranteed to exist.

Input

The first line contains three space-separated integers EE, LL, and BB. Each of the next BB lines contains one integer, the coordinate of a buried cow.

Output

Print a single integer: the smallest number of legal leaps Bessie needs to reach coordinate EE.

Hint

The diagram shows the beach and the leaps. The letter c marks a cow.

# # c c # #   <--- cow denoted by 'c'
0 1 2 3 4 5   <--- location numbers
  1     2 3   <--- where leaps 1, 2, and 3 end

Examples1

  1. Example 1

    Input
    5 3 2
    2
    3
    
    Expected output
    3