#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, i, j, x, y, z, amin, amax;
  cin >> n >> k;
  long long a[4001];
  memset(a, 0, sizeof(a));
  i = 0;
  amax = 0;
  while (i < k) {
    cin >> x;
    if (x == 1) {
      cin >> y >> z;
      a[y] = 1;
      a[z] = 1;
      amax = amax + 2;
    } else if (x == 2) {
      cin >> y;
      a[y] = 1;
      amax = amax + 1;
    }
    i++;
  }
  amax = n - amax - 1;
  i = 1;
  amin = 0;
  while (i < n) {
    if (a[i] == 0 && i + 1 < n && a[i + 1] == 0) {
      amin++;
      i = i + 2;
    } else if (a[i] == 0) {
      amin++;
      i++;
    } else {
      i++;
    }
  }
  cout << amin << " " << amax << "\n";
}
