#include <bits/stdc++.h>
using namespace std;
int a[111111], m[111111], t[111111];
int main() {
  int n, k;
  cin >> n >> k;
  int num = 0, sum = 0;
  for (int i = 1; i <= k; i++) {
    cin >> m[i];
    for (int j = 0; j < m[i]; j++) {
      cin >> t[j];
    }
    if (t[0] == 1) {
      num = 1;
      for (int j = 1; j < m[i]; j++) {
        if (t[j] == t[0] + j) num++;
      }
      sum = n - k - num + 1;
    }
  }
  sum += n - num;
  cout << sum << endl;
}
