Longest holiday after cancelling

Days are numbered 1 to N, and M of them have an appointment. You may cancel at most K appointments. Find the longest run of consecutive days without an appointment you can get.

Reported in: Infosys (SP / DSE · earlier papers) (memory-based)

Input

First line: N M K. Second line: the M appointment days.

Output

The longest run of free days.

Constraints

1 ≤ N ≤ 10^9; 1 ≤ M ≤ 10^5; 0 ≤ K ≤ M; days are distinct.

Example 1

Input:
10 3 1
3 6 8

Output:
5

Example 2

Input:
7 2 0
1 7

Output:
5

Example 3

Input:
5 2 2
2 4

Output:
5

Hint: Cancel K appointments that sit next to each other in sorted order. Add day 0 and day N + 1 as walls; the run between p[i] and p[i + K + 1] then has p[i + K + 1] − p[i] − 1 free days. Take the largest.

All coding practice