#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[200005], cnt = 0, i, j;
  for (i = 0; i < k; i++) {
    int c;
    cin >> c;
    for (j = 1; j <= c; j++) {
      int x;
      cin >> x;
      if (x == j) {
        cnt++;
      }
    }
  }
  cout << 2 * (n - cnt) + 1 - k << endl;
  return 0;
}
