#ABC185D. [ABC185D] Stamp

[ABC185D] Stamp

Score : 400400 points

Problem Statement

There are NN squares arranged in a row from left to right. Let Square ii be the ii-th square from the left. MM of those squares, Square A1A_1, A2A_2, A3A_3, \ldots, AMA_M, are blue; the others are white. (MM may be 00, in which case there is no blue square.) You will choose a positive integer kk just once and make a stamp with width kk. In one use of a stamp with width kk, you can choose kk consecutive squares from the NN squares and repaint them red, as long as those kk squares do not contain a blue square. At least how many uses of the stamp are needed to have no white square, with the optimal choice of kk and the usage of the stamp?

Constraints

  • 1N1091 \le N \le 10^9
  • 0M2×1050 \le M \le 2 \times 10^5
  • 1AiN1 \le A_i \le N
  • AiA_i are pairwise distinct.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

$A_1 \hspace{7pt} A_2 \hspace{7pt} A_3 \hspace{5pt} \dots \hspace{5pt} A_M$

Output

Print the minimum number of uses of the stamp needed to have no white square.

5 2
1 3
3

If we choose k=1k = 1 and repaint the three white squares one at a time, three uses are enough, which is optimal. Choosing k=2k = 2 or greater would make it impossible to repaint Square 22, because of the restriction that does not allow the kk squares to contain a blue square.

13 3
13 3 9
6

One optimal strategy is choosing k=2k = 2 and using the stamp as follows:

  • Repaint Squares 1,21, 2 red.
  • Repaint Squares 4,54, 5 red.
  • Repaint Squares 5,65, 6 red.
  • Repaint Squares 7,87, 8 red.
  • Repaint Squares 10,1110, 11 red.
  • Repaint Squares 11,1211, 12 red.

Note that, although the kk consecutive squares chosen when using the stamp cannot contain blue squares, they can contain already red squares.

5 5
5 2 1 4 3
0

If there is no white square from the beginning, we do not have to use the stamp at all.

1 0
1

MM may be 00.