#include <bits/stdc++.h>
struct st {
  int l, r, p;
  bool operator<(const st& B) const {
    return l > B.l || (l == B.l && r < B.r) ||
           (l == B.l && r == B.r && p < B.p);
  }
} a[1000005];
int N, M, T, S, ans[1000005], s[1000005];
void add(int x) {
  for (; x <= S; x += x & -x) s[x]++;
}
int sum(int x) {
  int d = 0;
  for (; x; x -= x & -x) d += s[x];
  return d;
}
int main() {
  scanf("%d%d", &N, &M), T = N, S = 1e6 + 1;
  for (int i = 1; i <= N; i++) scanf("%d%d", &a[i].l, &a[i].r);
  for (int i = 1, s, x, p; i <= M; i++) {
    scanf("%d%d", &s, &p), ans[i] = N;
    if (p > 1) a[++T].l = 1, a[T].r = p - 1, a[T].p = i;
    for (; --s; p = x) {
      scanf("%d", &x);
      if (p < x - 1) a[++T].l = p + 1, a[T].r = x - 1, a[T].p = i;
    }
    if (p < S) a[++T].l = p + 1, a[T].r = S, a[T].p = i;
  }
  std::sort(a + 1, a + T + 1);
  for (int i = 1; i <= T; i++)
    if (a[i].p)
      ans[a[i].p] -= sum(a[i].r);
    else
      add(a[i].r);
  for (int i = 1; i <= M; i++) printf("%d\n", ans[i]);
}
