Problem: Range Count Query

Given the sequence a_1, a_2, .., a_N.

In the query, answer the number of terms whose value is l or more and r or less.

input


N Q
a_1 a_2 ... a_N
l_1 r_1
l_2 r_2
::
l_q r_q


output


ans_1
ans_2
::
ans_q


On line i, output the answer to the i-th query, that is, the number of j such as l_i \ leq a_j \ leq r_i.

Constraint

* 1 \ leq N, Q \ leq 10 ^ 5
* 1 \ leq a_i \ leq 10 ^ 9
* 1 \ leq l_i \ leq r_i \ leq 10 ^ 9



Input example


6 3
8 6 9 1 2 1
2 8
1 7
3 5


Output example


3
Four
0






Example

Input

6 3
8 6 9 1 2 1
2 8
1 7
3 5


Output

3
4
0

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9+7;
//const ll MOD = 998244353;
//const ll MOD = 924844033;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
const double EPS = 1e-5;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), outendl())
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}


int main(){
	int n,q;
	cin >> n >> q;
	vector<int> line(n);
	foreach(i,line)cin>>i;
	sort(all(line));
	rep(i,q){
		int l,r;
		cin >> l >> r;
		cout << upper_bound(all(line),r) - lower_bound(all(line),l) << endl;
	}
	return 0;
}