#include <bits/stdc++.h>
using namespace std;
int d1[4004], d2[4004];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int x, k;
  cin >> x >> k;
  int t, a, b;
  memset(d1, 0, sizeof d1);
  memset(d2, 0, sizeof d2);
  for (int i = 0; i < (k); ++i) {
    cin >> t >> a;
    d2[a] = 1;
    if (t == 1) {
      cin >> b;
      d1[b] = 1;
    }
  }
  int unused = 0;
  int mmin = 0;
  int mmax = 0;
  for (int i = 1; i < x; ++i) {
    if (!d1[i] and !d2[i])
      unused++;
    else {
      mmin += (unused + 1) >> 1;
      mmax += unused;
      unused = 0;
    }
  }
  mmin += (unused + 1) >> 1;
  mmax += unused;
  unused = 0;
  cout << mmin << " " << mmax << endl;
  return 0;
}
