#include <bits/stdc++.h>
using namespace std;
long h[4002], x, n, cn, ucn, a, b, i;
int main() {
  cn = 0;
  ucn = 0;
  cin >> x >> n;
  h[x] = 1;
  for (i = 1; i <= n; i++) {
    cin >> b;
    cin >> a;
    h[a] = 1;
    if (b == 1) {
      cin >> b;
      h[b] = 1;
    }
  }
  a = 0;
  b = 0;
  for (int i = 1; i <= x; i++)
    if (h[i]) {
      ucn += a / 2;
      a = 0;
    } else {
      cn++;
      a++;
    }
  cout << cn - ucn << ' ' << cn << endl;
  return 0;
}
