#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k, div, a, b;
  while (cin >> x >> k) {
    bool flag[4003] = {false};
    for (int i = 0; i < k; i++) {
      cin >> div;
      if (div == 2)
        flag[cin >> a, a] = true;
      else {
        cin >> a >> b;
        flag[b] = flag[a] = true;
      }
    }
    int cnt = 0, out1 = 0, out2 = 0;
    for (int i = 1; i < x; i++) {
      if (flag[i] == false) cnt++;
      if (flag[i] == true or i == x - 1) {
        out1 += cnt / 2;
        out2 += cnt;
        if (cnt % 2) out1++;
        cnt = 0;
      }
    }
    cout << out1 << " " << out2 << endl;
  }
  return 0;
}
