#include <bits/stdc++.h>
using namespace std;
int a[4000];
int main() {
  int x, k, n, t;
  int i;
  cin >> x >> k;
  for (i = 0; i < k; i++) {
    cin >> n;
    if (n == 1) {
      cin >> t;
      a[t] = 1;
    }
    cin >> t;
    a[t] = 1;
  }
  a[x] = 1;
  int minn = 0, maxx = 0, cnt = 0;
  for (i = 1; i <= x; i++) {
    if (a[i] == 0)
      cnt++;
    else {
      minn += (cnt + 1) / 2;
      maxx += cnt;
      cnt = 0;
    }
  }
  cout << minn << " " << maxx;
}
