#include<bits/stdc++.h>
using namespace std;

using ll = long long;
#define REP(i,n) for(int i = 0;i < n;i++)

/*
*	verified : http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4713284#1
*	last revised : 29.July.2020 
 */
template<class T> class BIT {
private:
	int n;
	vector<T> dat;//[1,n]
public:
	BIT(int maxn, int _n) {
		dat.assign(maxn + 1, 0);
		n = _n;
	}
	T sum(int i) {
		T res = 0;
		while (i > 0) {
			res += dat[i];
			i -= i & -i;
		}
		return res;
	}
	void add(int i, T x) {
		while (i <= n) {
			dat[i] += x;
			i += i & -i;
		}
	}
};
#define maxn 500050
#define F first
#define S second
struct range{
  int l,r,id;
  range(){}
  range(int l,int r,int id):l(l),r(r),id(id){}
};
bool comp(range& a,range& b){
  return a.r < b.r;
}
int main(){
  cin.tie(0);ios::sync_with_stdio(false);  
  int N,Q;cin >> N >> Q;
  vector<int> c(N+1);
  for(int i=1;i<=N;i++)cin>>c[i];
  vector<range> a(Q);
  for(int i=0;i<Q;i++){
    int l,r;cin >> l >> r;
    a[i] = range(l,r,i);
  }
  sort(a.begin(),a.end(),comp);
  BIT<int> bit(maxn,maxn);
  vector<int> good(maxn,0);
  vector<int> ans(Q,0);
  int i = 0,j = 1;
  for(;i < Q;i++){
    for(;j <= a[i].r;j++){
      if(good[c[j]] == 0){
        bit.add(j,1);
      }else{
        bit.add(good[c[j]],-1);
        bit.add(j,1);
      }
      good[c[j]] = j;
    }
    if(a[i].l == 1) ans[a[i].id] = bit.sum(a[i].r);
    else ans[a[i].id] = bit.sum(a[i].r) - bit.sum(a[i].l-1);
  }
  for(int i=0;i<Q;i++)cout << ans[i] << '\n';
}

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
double pi = 3.1415926535897932384646433;
typedef long long ll;
typedef pair<ll, ll>pii;
ll ccw(pii a, pii b, pii c)
{
  return (b.first - a.first)*(c.second - b.second) - (b.second - a.second)*(c.first - b.first);
}
double dist(pii a, pii b)
{
  return sqrt(double((b.first - a.first)*(b.first - a.first) + (b.second - a.second)*(b.second - a.second)));
}
double dot(pii a, pii b)
{
  return double(a.first*b.first + a.second*b.second);
}
double ans[111];
int main()
{
  fill(ans, ans + 111, 0);
  int num;
  scanf("%d", &num);
  vector<pii>v;
  map<pii, int>ma;
  for (int i = 0; i < num; i++)
  {
    ll a, b;
    scanf("%lld%lld", &a, &b);
    v.push_back(make_pair(a, b));
    ma[make_pair(a, b)] = i;
  }
  sort(v.begin(), v.end());
  vector<pii>v1, v2;
  for (int i = 0; i < num; i++)
  {
    for (;;)
    {
      if (v1.size() <= 1)break;
      pii a = v1[v1.size() - 2], b = v1[v1.size() - 1];
      if (ccw(a, b, v[i])<0)v1.pop_back();
      else break;
    }
    v1.push_back(v[i]);
  }
  for (int i = 0; i < num; i++)
  {
    for (;;)
    {
      if (v2.size() <= 1)break;
      pii a = v2[v2.size() - 2], b = v2[v2.size() - 1];
      if (ccw(a, b, v[i])>0)v2.pop_back();
      else break;
    }
    v2.push_back(v[i]);
  }
  for (int i = int(v2.size()) - 2; i >= 1; i--)v1.push_back(v2[i]);
  for (int i = 0; i < v1.size(); i++)
  {
    pii s = v1[(i + v1.size() - 1) % v1.size()];
    pii t = v1[i];
    pii u = v1[(i + 1) % v1.size()];
    //printf("%lld %lld  %lld %lld  %lld %lld\n", s.first, s.second, t.first, t.second, u.first, u.second);
    double x = acos(dot(make_pair(u.first - t.first, u.second - t.second), make_pair(s.first - t.first, s.second - t.second)) / dist(s, t) / dist(t, u));
    ans[ma[v1[i]]] = (pi - x) / (2 * pi);
  }
  for (int i = 0; i < num; i++)printf("%.6lf\n", ans[i]);
}
