#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, k, i, j, max1 = 0, min1 = 0, max2 = 0, num1, num2, num3,
                     array1[100000], ans2, ans1;
  cin >> x;
  cin >> k;
  for (j = 0; j <= 10000; j++) {
    array1[j] = 0;
  }
  for (i = 0; i < k; i++) {
    cin >> num1;
    if (num1 == 1) {
      cin >> num2;
      array1[num2] = -1;
      cin >> num3;
      array1[num3] = -1;
    } else if (num1 == 2) {
      cin >> num2;
      array1[num2] = -1;
    }
  }
  for (j = 1; j <= x; j++) {
    if (array1[j] != -1) {
      max1++;
    }
  }
  ans1 = max1 - 1;
  for (j = 1; j < x - 1; j++) {
    if (array1[j] != -1 && array1[j + 1] != -1) {
      max1--;
      j = j + 1;
    }
  }
  ans2 = max1 - 1;
  cout << ans2 << " " << ans1 << endl;
}
