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