题目描述
Problem Description
※Kitamura is the name of the person who helped create this problem. Also, Kitamura's girlfriend is not Iroha-chan.
Kitamura is a member of his high school's competitive programming club and diligently works on programming even after school. However, it seems Kitamura has recently got a girlfriend.
He wants to go on a date! He wants to go on a date! He wants to go on a date!
The time spent on programming is steadily being eroded by the desire to go on a date. Feeling a sense of crisis that Kitamura's rating will drop if this continues, you decide to help manage his after-school schedule.
You decide to make a schedule for the next $N$ days, taking the following points into consideration:
- Kitamura can either "go on a date" or "do competitive programming" during each day's after-school time.
- Kitamura cannot go on a date for more than $A$ days in a row, or he will lack love and be unable to move, so he must go on a date at least once every $A$ days.
- There are $B$ anniversaries within the next $N$ days starting from tomorrow, on days $D_1, D_2, \cdots, D_B$. He must go on a date on these days. $D_i$ are all distinct.
Note that Kitamura went on a date today, and there are no holidays at his high school. You want to maximize the number of days Kitamura can work on competitive programming.
Input Format
The input is given from the standard input in the following format:
$N$ $A$ $B$ $D_1$ $D_2$ $\cdots$ $D_B$
Output Format
Output the maximum number of days Kitamura can study programming in one line.
Sample Input and Output
Sample Input #1
10 4 2
4 6
Sample Output #1
7
Sample Input #2
10 1 0
Sample Output #2
0
Sample Input #3
5 2 5
1 2 3 4 5
Sample Output #3
0
Sample Input #4
10 5 3
4 3 7
Sample Output #4
7
Sample Input #5
100 16 11
90 98 88 82 40 16 32 45 87 67 48
Sample Output #5
88
Notes/Hints
Constraints
- All input values are integers.
- $1 \leq N \leq 10^{18}$
- $1 \leq A \leq N$
- $0 \leq B \leq \min(N, 2 \times 10^5)$
- $1 \leq D_i \leq N$ $(1 \leq i \leq B)$
- $D_i \neq D_j$ $(1 \leq i, j \leq B$ and $i \neq j)$
- All inputs are integers.
Sample Explanation 1
Consider the schedule for the next 10 days, where Kitamura cannot do competitive programming for more than 4 days in a row, and there are 2 anniversaries on the 4th and 6th days. If we denote competitive programming as P and dating as D, we can schedule it as PPPDPDPPPD, allowing him to work on competitive programming for 7 days.
Sample Explanation 2
Too lonely.
Sample Explanation 3
Too many anniversaries.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分