#include <bits/stdc++.h>
using namespace std;
const int maxn = 3 * 100 * 100 * 100 + 10;
const int INF = 4 * 100 * 100 * 100;
pair<pair<int, int>, int> pairr[maxn];
pair<int, int> r[maxn];
int d[4 * maxn], l[maxn], ans[maxn];
void add(int l, int r, int ind, int b, int e) {
  if (l <= b && e <= r) {
    d[ind]++;
    return;
  }
  int mid = (b + e) / 2;
  if (l < mid) add(l, r, ind * 2, b, mid);
  if (r > mid) add(l, r, ind * 2 + 1, mid, e);
  return;
}
int get(int p, int ind, int b, int e) {
  int ret = d[ind];
  if (e - b == 1) return ret;
  int mid = (b + e) / 2;
  if (p < mid)
    ret += get(p, ind * 2, b, mid);
  else
    ret += get(p, ind * 2 + 1, mid, e);
  return ret;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i].first;
    r[i].first++;
    r[i].second = i;
  }
  int j = 0, cnt, p, temp;
  for (int i = 0; i < q; i++) {
    cin >> cnt;
    cin >> p;
    temp = p;
    pairr[j].first = (make_pair(p, 0));
    pairr[j].second = i;
    j++;
    for (int k = 1; k < cnt; k++) {
      cin >> p;
      pairr[j].first = (make_pair(p, temp));
      temp = p;
      pairr[j].second = i;
      j++;
    }
    pairr[j].first = (make_pair(INF, p));
    pairr[j].second = i;
    j++;
  }
  sort(pairr, pairr + j);
  sort(r, r + n);
  int cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < INF + 20; i++) {
    while (r[cnt1].first == i) {
      add(0, l[r[cnt1].second], 1, 0, INF);
      cnt1++;
    }
    while (pairr[cnt2].first.first == i) {
      ans[pairr[cnt2].second] += get(pairr[cnt2].first.second, 1, 0, INF);
      cnt2++;
    }
  }
  for (int i = 0; i < q; i++) cout << n - ans[i] << endl;
  return 0;
}
