#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6;
pair<int, int> segs[maxn];
int lsorted[maxn];
int rsorted[maxn];
int lsrtdidx[maxn];
vector<int> questions[maxn];
pair<int, int> queries[maxn];
int ansqrs[maxn];
vector<int> qs_qr_idxs[maxn];
vector<int> qrsendinginR[maxn];
vector<int> segsendinginR[maxn];
int vals[maxn];
int N;
int qrcnt = 0;
inline int add_qr(int x, int y) {
  queries[qrcnt] = {x, y};
  return qrcnt++;
}
void turnon(int p, int l, int r, int v) {
  if (r <= l) return;
  if (p < l or p >= r) return;
  if (r - l == 1) {
    vals[v] = 1;
    return;
  }
  int m = (l + r) / 2;
  turnon(p, l, m, 2 * v);
  turnon(p, m, r, 2 * v + 1);
  vals[v] = vals[2 * v] + vals[2 * v + 1];
}
int get(int l, int r, int s, int e, int v) {
  if (r <= l) return 0;
  if (e <= l or r <= s) return 0;
  if (s <= l and r <= e) return vals[v];
  int m = (l + r) / 2;
  return get(l, m, s, e, 2 * v) + get(m, r, s, e, 2 * v + 1);
}
inline int bins(int x) {
  int down = -1;
  int up = N;
  while (up - down > 1) {
    int mid = (up + down) / 2;
    if (segs[lsorted[mid]].first < x)
      down = mid;
    else
      up = mid;
  }
  return up;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  N = n;
  for (int i = 0; i < n; i++) cin >> segs[i].first >> segs[i].second;
  for (int i = 0; i < n; i++) lsorted[i] = rsorted[i] = i;
  sort(lsorted, lsorted + n,
       [&](int i, int j) { return segs[i].first < segs[j].first; });
  sort(rsorted, rsorted + n,
       [&](int i, int j) { return segs[i].second < segs[j].second; });
  for (int i = 0; i < n; i++) lsrtdidx[lsorted[i]] = i;
  for (int i = 0; i < m; i++) {
    int k;
    cin >> k;
    questions[i] = vector<int>(k);
    for (int j = 0; j < k; j++) cin >> questions[i][j];
    int last = 0;
    for (int j = 0; j < k; j++) {
      int cur = questions[i][j];
      qs_qr_idxs[i].push_back(add_qr(last + 1, cur));
      last = cur;
    }
    qs_qr_idxs[i].push_back(add_qr(last + 1, maxn - 1));
  }
  for (int i = 0; i < qrcnt; i++) qrsendinginR[queries[i].second].push_back(i);
  for (int i = 0; i < n; i++) segsendinginR[segs[i].second].push_back(i);
  for (int i = 0; i < maxn; i++) {
    for (int j : qrsendinginR[i]) {
      int ql = queries[j].first;
      int qr = i;
      int l = bins(ql);
      int r = bins(qr);
      ansqrs[j] = get(0, n, l, r, 1);
    }
    for (int j : segsendinginR[i]) {
      turnon(lsrtdidx[j], 0, n, 1);
    }
  }
  for (int i = 0; i < m; i++) {
    int a = 0;
    for (int j : qs_qr_idxs[i]) a += ansqrs[j];
    cout << n - a << endl;
  }
  return 0;
}
