#include <bits/stdc++.h>
using namespace std;
long long count_number(long long n) {
  long long res = 0;
  while (n != 0) {
    if (n % 10 == 1) res++;
    n /= 10;
  }
  return res;
}
int main() {
  int x, k;
  cin >> x >> k;
  bool total[x + 1];
  for (int i = 0; i < x; i++) total[i] = false;
  for (int i = 0; i < k; i++) {
    int temp;
    cin >> temp;
    if (temp == 2) {
      int temp1;
      cin >> temp1;
      total[temp1] = true;
    } else {
      int temp1, temp2;
      cin >> temp1 >> temp2;
      total[temp1] = true;
      total[temp2] = true;
    }
  }
  int min = 0, max = 0, min_count = 0;
  for (int i = 1; i < x; i++) {
    if (total[i] == true) {
      if (min_count == 1) {
        min++;
        min_count = 0;
      }
      continue;
    } else {
      max++;
      if (min_count == 0)
        min_count++;
      else {
        min++;
        min_count = 0;
      }
    }
  }
  if (min_count == 1) min++;
  cout << min << " " << max << endl;
}
