#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, chain, in1, in2, tcontinue, tuncontinue;
  while (cin >> n) {
    cin >> k;
    tuncontinue = 0;
    tcontinue = 0;
    for (int tmp = 0; tmp < k; tmp++) {
      in2 = 0;
      in1 = 0;
      cin >> chain;
      cin >> in1;
      for (int tmp = 1; tmp < chain; tmp++) {
        cin >> in2;
        if (in2 - in1 == 1)
          tcontinue++;
        else
          tuncontinue++;
        in1 = in2;
      }
    }
    cout << tcontinue << endl;
    cout << tuncontinue << endl;
    cout << n - 1 - tcontinue + tuncontinue << endl;
  }
  return 0;
}
