#include <bits/stdc++.h>
using namespace std;
int arr[5000];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      int y, z;
      cin >> y >> z;
      arr[y] = 2;
      arr[z] = 1;
    } else {
      int y;
      cin >> y;
      arr[y] = 2;
    }
  }
  int mx = 0, mn = 0;
  for (int i = 1; i < n; i++) {
    if (arr[i] == 0) {
      mx++;
    }
  }
  for (int i = 1; i < n; i++) {
    if (arr[i] == 0) {
      mn++;
      arr[i] = 2;
      if (i + 1 < n and arr[i + 1] == 0) {
        arr[i + 1] = 1;
      }
    }
  }
  cout << mn << " " << mx << endl;
  return 0;
}
