#include <bits/stdc++.h>
using namespace std;
const int maxn = 3 * 1000 * 100 + 10;
int n, m, node[21][maxn];
pair<int, int> p[maxn];
vector<int> rights;
inline int input() {
  int x;
  scanf("%d", &x);
  return x;
}
void build(int s, int e, int row) {
  if (s + 1 == e) {
    node[row][s] = p[s].first;
    return;
  }
  int mid = (s + e) / 2;
  build(s, mid, row + 1);
  build(mid, e, row + 1);
  merge(node[row + 1] + s, node[row + 1] + mid, node[row + 1] + mid,
        node[row + 1] + e, node[row] + s);
}
int get(int s, int e, int l, int r, int lim1, int lim2, int row) {
  if (r <= l or lim2 <= lim1) return 0;
  if (r <= s or l >= e) return 0;
  if (l <= s and r >= e)
    return lower_bound(node[row] + s, node[row] + e, lim2) -
           lower_bound(node[row] + s, node[row] + e, lim1);
  int mid = (s + e) / 2;
  return get(s, mid, l, r, lim1, lim2, row + 1) +
         get(mid, e, l, r, lim1, lim2, row + 1);
}
inline bool cmp(pair<int, int> a, pair<int, int> b) {
  return a.second < b.second;
}
int main() {
  n = input();
  m = input();
  for (int i = 1; i <= n; i++) {
    p[i].first = input();
    p[i].second = input();
    rights.push_back(p[i].second);
  }
  sort(p + 1, p + 1 + n, cmp);
  sort(rights.begin(), rights.end());
  build(1, n + 1, 1);
  for (int i = 1; i <= m; i++) {
    int ans = 0, cnt;
    cnt = input();
    int point[cnt + 1];
    for (int j = 1; j <= cnt; j++) {
      point[j] = input();
      if (j == 1) {
        int pos = lower_bound(rights.begin(), rights.end(), point[j]) -
                  rights.begin();
        ans += get(1, n + 1, 1, pos + 1, 1, point[j], 1);
      }
      if (j == cnt) {
        int pos = upper_bound(rights.begin(), rights.end(), point[j]) -
                  rights.begin() + 1;
        ans += get(1, n + 1, pos, n + 1, point[j] + 1, 1000000 + 1, 1);
      }
      if (j != 1) {
        int pos1 = upper_bound(rights.begin(), rights.end(), point[j - 1]) -
                   rights.begin() + 1;
        int pos2 = lower_bound(rights.begin(), rights.end(), point[j]) -
                   rights.begin();
        ans += get(1, n + 1, pos1, pos2 + 1, point[j - 1] + 1, point[j], 1);
      }
    }
    cout << n - ans << endl;
  }
}
