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