#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k, tmp, z, y;
  cin >> x >> k;
  vector<bool> s(x);
  for (int i = 0; i < x; ++i) s[i] = false;
  s[0] = true;
  for (int i = 0; i < k; ++i) {
    cin >> tmp;
    if (tmp == 1) {
      cin >> z >> y;
      s[z] = true;
      s[y] = true;
    } else {
      cin >> z;
      s[z] = true;
    }
  }
  int min = 0, max = 0, count = 0;
  for (int i = 1; i < x; ++i) {
    if (!s[i]) {
      ++count;
    } else {
      max += count;
      min += count / 2 + count % 2;
      count = 0;
    }
  }
  if (count != 0) {
    max += count;
    min += count / 2 + count % 2;
  }
  cout << min << ' ' << max;
}
