#include <bits/stdc++.h>
using namespace std;
const int N = 1E6;
int arr[N];
bool b[N];
int main() {
  memset(b, true, sizeof(b));
  long long x, n;
  cin >> x >> n;
  b[x] = false;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a == 1) {
      int x, y;
      cin >> x >> y;
      b[x] = false;
      b[y] = false;
    } else if (a == 2) {
      int x;
      cin >> x;
      b[x] = false;
    }
  }
  long long maxi = 0, mini = 0;
  vector<int> vc;
  for (int i = 1; i <= x; i++) {
    if (b[i] == true) {
      vc.push_back(i);
      maxi++;
    }
  }
  for (int i = 0; i < vc.size(); i++) {
    if (vc[i + 1] - vc[i] == 1) {
      mini++;
      i++;
    }
  }
  cout << maxi - mini << " " << maxi << endl;
  return 0;
}
