#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=3000010;
int ans[maxn];
struct Interval
{
int l,r,id;
}I[maxn],q[maxn];
bool cmp(Interval a,Interval b)
{
return a.r<b.r;
}
int tree[maxn];
int lowbit(int x) {return x&-x; }
void Add(int x)
{
while(x<1000010)
{
tree[x]+=1;
x+=lowbit(x);
}
}
int getSum(int x)
{
int sum=0;
while(x>0)
{
sum+=tree[x];
x-=lowbit(x);
}
return sum;
}
int main()
{
int n,m;
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)
{
scanf("%d%d",&I[i].l,&I[i].r);
I[i].id=i;
}
int e=0;
for(int i=0;i<m;i++)
{
int t;
scanf("%d",&t);
for(int j=0;j<t;j++)
{
scanf("%d",&q[e].r);
q[e].id=i;
if(j==0) q[e].l=0;
else q[e].l=q[e-1].r;
e++;
}
q[e].id=i;
q[e].l=q[e-1].r;
q[e++].r=1000010;
}
sort(I,I+n,cmp);
sort(q,q+e,cmp);
for(int i=0;i<m;i++) ans[i]=n;
memset(tree,0,sizeof(tree));
int j=0;
for(int i=0;i<e;i++)
{
while(j<n&&I[j].r<q[i].r)
{
Add(I[j].l);j++;
}
ans[q[i].id]-=getSum(q[i].r-1)-getSum(q[i].l);
}
for(int i=0;i<m;i++)
printf("%d\n",ans[i]);
return 0;
}