题目描述
Problem Description
As a server administrator, you have been recording all access times to the server.
Now, to investigate the server load, you want to find the maximum number of accesses that occurred within any consecutive $n$ seconds, given an integer $n$.
Given $m$ logs of access times, create a program that finds the maximum number of accesses that occurred within any consecutive $n$ seconds.
Input Format
The input is given in the following format:
$ n $ $ m $ $ a_1 $ $ ... $ $ a_m $
- The first line contains the integer $n$ ($1 \leq n \leq 1{,}000{,}000{,}000$), representing the length of the access interval you want to find, and the integer $m$ ($1 \leq m \leq 100{,}000$), representing the total number of accesses.
- The following $m$ lines contain the time of each access.
- $a_i$ means that the $i$-th access occurred exactly at the $a_i$-th second.
- It is guaranteed that $0 \leq a_1 \leq a_2 \leq ... \leq a_m \leq 1{,}000{,}000{,}000$.
Output Format
Output the maximum number of accesses that occurred within any $n$ seconds in one line.
End with a newline and do not include any extra characters or blank lines.
Sample Input and Output
Sample Input #1
1 5
0
0
0
1
2
Sample Output #1
4
Sample Input #2
3 6
7
7
9
9
11
12
Sample Output #2
4
Notes/Hints
None
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
1 5
0
0
0
1
2
样例输出
4