n,a=map(int,input().split()) x=list(map(int,input().split())) t=int(input()) q=[tuple(map(int,input().split())) for i in range(t)] for i in range(n): c=0 for j in range(t): c+=q[j][0]<=x[i]<=q[j][1] print(c)