#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, k = 0, x;
  scanf("%d %d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &x);
    for (j = 1; j <= x; j++) {
      int a;
      scanf("%d", &a);
      k = (a == j ? k + 1 : k);
    }
  }
  cout << (2 * n) - m + 1 - (2 * k) << endl;
}
