PivotOJ

Why Did the Cow Cross the Road II (Silver)

시간 제한: 2000ms메모리 제한: 512MB출처: USACO 2017 February Contest, SilverBOJ 14465

문제

The long road through Farmer John's farm has N crosswalks across it, conveniently numbered 1…N (1 ≤ N ≤ 100,000). 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.

입력

The first line of input contains N, K, and B (1 ≤ B,K ≤ N). The next B lines each describe the ID number of a broken signal.

출력

Please 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.

예제

예제 1

입력
10 6 5
2
10
1
5
9
출력
1
코드를 제출하려면 로그인하세요.