#include <bits/stdc++.h>
double eps = 1e-9;
using namespace std;
int arr[4002];
int main() {
  std::ios::sync_with_stdio(false);
  int x, k;
  cin >> x >> k;
  int counts = 0;
  for (int i = 0; i < k; ++i) {
    int a;
    cin >> a;
    if (a == 1) {
      int b, c;
      cin >> b >> c;
      arr[b] = 1;
      arr[c] = 1;
    } else {
      int b;
      cin >> b;
      arr[b] = 1;
    }
  }
  int mina = 0, maxa = 0;
  for (int i = 1; i < x; ++i) {
    if (arr[i] == 1) {
      maxa += counts;
      mina += (counts + 1) / 2;
      counts = 0;
    } else {
      counts++;
    }
  }
  if (counts != 0) {
    maxa += counts;
    mina += (counts + 1) / 2;
  }
  cout << mina << " " << maxa;
  return 0;
}
