AT_awc0001_e 気温の変動幅
Description
Takahashi is analyzing weather data. There is a record of temperature observations taken over $ N $ consecutive days in a certain region, where the temperature on day $ i $ was $ H_i $ degrees.
Takahashi wants to select a consecutive period of $ K $ days from this observation data and investigate the temperature variation range during that period.
Here, the "temperature variation range" for a consecutive period of $ K $ days is defined as the difference between the maximum temperature and the minimum temperature during that period.
Takahashi wants to find a consecutive period of $ K $ days that maximizes the temperature variation range. Find the maximum value of the temperature variation range.
Input Format
> $ N $ $ K $ $ H_1 $ $ H_2 $ $ \ldots $ $ H_N $
- The first line contains $ N $ , representing the number of observation days, and $ K $ , representing the number of consecutive days to select, separated by a space.
- The second line contains $ H_1, H_2, \ldots, H_N $ , representing the temperature on each day, separated by spaces.
Output Format
Output the maximum value of the temperature variation range in one line.
Explanation/Hint
### Constraints
- $ 1 \leq K \leq N \leq 2 \times 10^5 $
- $ -10^9 \leq H_i \leq 10^9 $
- All inputs are integers