#include<stdio.h>
#define LMAX 10100
int x[LMAX];
short int f[400100];

int main()
{
	int n,i,k,val,primu,max=-1;
	
	freopen("punctfix.in","r",stdin);
	freopen("punctfix.out","w",stdout);
	
	scanf("%d%d",&n,&primu); x[1]=0; f[100101]=1;
	for(i=2;i<=n;i++)
	{
		scanf("%d",&x[i]);
		x[i]-=primu;
		f[i-x[i]+100100]++;
		if(i-x[i]>max)
			max=i-x[i];
	}
	scanf("%d",&k);
	
	for(i=1;i<=k;i++)
	{
		scanf("%d",&val);
		val+=primu;
		if(val>max || val+100100<0)
		{
			printf("0\n");
			continue;
		}
		printf("%d\n",f[val+100100]);
	}
	return 0;
}

		