#include <bits/stdc++.h>
using namespace std;
int main() {
  map<long long, long long> isolados;
  long long n, k, i, j, prox, qtd, x, resp;
  bool first = true;
  while (cin >> n >> k) {
    resp = 0;
    isolados.clear();
    prox = -1;
    first = true;
    for (i = 0; i < k; i++) {
      cin >> qtd;
      for (j = 0; j < qtd; j++) {
        cin >> x;
        if (x == 1) prox = 1;
        if (x == prox && first == true) {
          prox++;
        } else if (j == 0) {
          isolados[x] = 0;
        } else {
          isolados[x] = 1;
        }
      }
      if (prox != -1) first = false;
    }
    for (prox; prox <= n; prox++) {
      resp += isolados[prox] + 1;
    }
    cout << resp << endl;
  }
  return 0;
}
