#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, cnt = 0;
  scanf("%d", &n);
  scanf("%d", &k);
  int par[n + 1];
  int i, j, m;
  for (i = 0; i < n; i++) par[i] = -1;
  for (i = 0; i < k; i++) {
    scanf("%d", &m);
    int b[m + 1];
    for (j = 0; j < m; j++) {
      scanf("%d", &b[j]);
    }
    for (j = 0; j < m; j++) {
      if (j == 0)
        par[b[j]] = b[j];
      else if (b[j] == b[j - 1] + 1)
        par[b[j]] = b[j - 1];
      else {
        cnt++;
        par[b[j]] = b[j];
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (par[i] == i) cnt++;
  }
  printf("%d ", cnt);
  printf("\n");
  return 0;
}
