#include <bits/stdc++.h>
using namespace std;
template <typename T>
T nextInt() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') {
    p = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * p;
}
const int maxN = (int)1e6 + 10;
const int maxK = 17;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const long long LLINF = (long long)1e18;
vector<int> g[maxN];
int n, m;
template <typename T>
struct segmentTree {
  int n;
  vector<int> t[4 * maxN];
  segmentTree() {}
  segmentTree(int n) : n(n) { build(1, 0, n - 1); }
  void mymerge(const vector<int> &a, const vector<int> &b, vector<int> &res) {
    int n = (int)a.size(), m = (int)b.size();
    res.resize(n + m);
    int itA = 0, itB = 0, itRES = 0;
    while (itA < n || itB < m) {
      if (itA == n) {
        res[itRES++] = b[itB++];
        continue;
      }
      if (itB == m) {
        res[itRES++] = a[itA++];
        continue;
      }
      if (a[itA] < b[itB]) {
        res[itRES++] = a[itA++];
        continue;
      }
      res[itRES++] = b[itB++];
    }
  }
  void build(int v, int l, int r) {
    if (l == r) {
      t[v] = g[r];
    } else {
      int m = (l + r) / 2;
      build(v + v, l, m);
      build(v + v + 1, m + 1, r);
      mymerge(t[v + v], t[v + v + 1], t[v]);
    }
  }
  int query(int l, int r, T x) {
    if (l > r) return 0;
    return query(1, l, r, x, 0, n - 1);
  }
  int query(int v, int l, int r, T x, int tl, int tr) {
    if (tl >= l && tr <= r) {
      return t[v].end() - lower_bound(t[v].begin(), t[v].end(), x);
    }
    int tm = (tl + tr) / 2;
    if (l > tm) {
      return query(v + v + 1, l, r, x, tm + 1, tr);
    }
    if (r <= tm) {
      return query(v + v, l, r, x, tl, tm);
    }
    return query(v + v, l, r, x, tl, tm) +
           query(v + v + 1, l, r, x, tm + 1, tr);
  }
};
segmentTree<int> *t;
int query(int l, int r) { return t->query(l, r, l); }
int main() {
  n = nextInt<int>();
  m = nextInt<int>();
  for (int i = 0; i < n; ++i) {
    int l, r;
    l = nextInt<int>();
    r = nextInt<int>();
    g[r].push_back(l);
  }
  for (int i = 0; i < maxN; ++i) {
    sort(g[i].begin(), g[i].end());
  }
  t = new segmentTree<int>(maxN);
  while (m--) {
    int c = nextInt<int>();
    vector<int> pts;
    pts.push_back(0);
    while (c--) {
      int p = nextInt<int>();
      pts.push_back(p);
    }
    pts.push_back((int)1e6 + 1);
    int res = n;
    for (int i = 0; i < pts.size() - 1; ++i) {
      res -= query(pts[i] + 1, pts[i + 1] - 1);
    }
    printf("%d\n", res);
  }
  return 0;
}
