#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k;
  cin >> x >> k;
  int *arr = new int[x];
  for (int i = 0; i < x; i++) arr[i] = 0;
  int st, div2, div1;
  for (int i = 0; i < k; i++) {
    cin >> st >> div2;
    arr[div2 - 1] = 1;
    if (st == 1) {
      cin >> div1;
      arr[div1 - 1] = 1;
    }
  }
  int max = 0;
  for (int i = 0; i < x - 1; i++) {
    if (arr[i] == 0) {
      max += 1;
    }
  }
  int min = 0;
  for (int i = 0; i < x - 1; i++) {
    if (arr[i] == 0) {
      min++;
      if (arr[i + 1] == 0) i++;
    }
  }
  cout << min << " " << max;
  return 0;
}
