#include <bits/stdc++.h>
using namespace std;
int n, x, k;
int ans, q, res;
bool a[4010];
bool b[4010];
int minn, maxx;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= k; i++) {
    cin >> q;
    if (q == 1) {
      cin >> x;
      a[x] = true;
      cin >> x;
      a[x] = true;
    } else {
      cin >> x;
      a[x] = true;
    }
  }
  for (int i = 1; i < n; i++) {
    if (!a[i]) {
      maxx++;
      if (!b[i]) {
        minn++;
        b[i + 1] = true;
      }
    }
  }
  cout << minn << ' ' << maxx;
  return 0;
}
