#include <bits/stdc++.h>
using namespace std;
int main() {
  int c = 0, n, k;
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    int m, x, t = 1;
    cin >> m;
    while (m--) {
      cin >> x;
      if (x == t) c++, t++;
    }
  }
  cout << n - c + 1 - k + n - c << endl;
  return 0;
}
