eolymp
bolt
Try our new interface for solving problems
Problems

Why Did the Cow Cross the Road II (Silver)

Why Did the Cow Cross the Road II (Silver)

The long road through Farmer John's farm has n crosswalks across it, conveniently numbered 1 .. n. To allow cows to cross at these crosswalks, FJ installs electric crossing signals, which light up with a green cow icon when it is ok for the cow to cross, and red otherwise. Unfortunately, a large electrical storm has damaged some of his signals. Given a list of the damaged signals, please compute the minimum number of signals that FJ needs to repair in order for there to exist some contiguous block of at least k working signals.

Input

The first line contains n (1n105), k and b (1b, kn). The next b lines each describe the ID number of a broken signal.

Output

Compute the minimum number of signals that need to be repaired in order for there to be a contiguous block of k working signals somewhere along the road.

Time limit 1 second
Memory limit 128 MiB
Input example #1
10 6 5
2
10
1
5
9
Output example #1
1
Source 2017 USACO February, Silver