King of Range
题号:NC222409
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Given integers and queries. For each query, you are given a const and you should determine how many different pairs are there meeting the condition that the range of the subsequence is strictly greater than .

Note: the range of a sequence equals the difference between the maximum and the minimum of the sequence.

输入描述:

The first line contains two integers , denoting the number of given integers and the number of queries respectively.

The second line contains n integers , denoting the given integers.

Next m lines each contains one integer , denoting the queries.

输出描述:

Print  lines each contains one integer, denoting the answers.
示例1

输入

复制
5 1
1 2 3 4 5
2

输出

复制
3

说明

There are three pairs, (1,4),(1,5),(2,5)_{}, which meet the condition.