PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#PS0000207. Đoạn dài nhất có trung bình ít nhất K (Longest Subarray with Average at Least K)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đoạn dài nhất có trung bình ít nhất K (Longest Subarray with Average at Least K)

Longest Subarray with Average at Least K

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given nn integers aia_i and an integer KK, find the maximum length of a nonempty consecutive interval whose average is at least KK. Print 0 if no such interval exists.

Input

The first line contains n,Kn,K. The second line contains exactly nn integers aia_i.

Output

Print the maximum length, or 0 if none exists.

Subtasks

  • Subtask 1 (30 points): 1≤n≤2001\le n\le 200; ∣ai∣≤109|a_i|\le10^9; ∣K∣≤109|K|\le10^9.
  • Subtask 2 (30 points): 1≤n≤2000001\le n\le 200000; ∣ai∣≤109|a_i|\le10^9; ∣K∣≤109|K|\le10^9; ai≤ai+1a_i\le a_{i+1} for all 1≤i<n1\le i<n.
  • Subtask 3 (40 points): 1≤n≤2000001\le n\le 200000; ∣ai∣≤109|a_i|\le10^9; ∣K∣≤109|K|\le10^9.

Example 1

Input

3 2
1 3 2

Output

3

Explanation

The full array has average 2 and maximum possible length 3.

Example 2

Input

3 0
-5 -2 -3

Output

0

Explanation

All elements are negative, so every interval has average below zero.