#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n, t, x, y;
  cin >> k >> n;
  int r[k + 1];
  memset(r, 0, sizeof r);
  r[0] = r[k] = 1;
  for (int i = 0; i < n; i++) {
    cin >> t;
    if (t - 1) {
      cin >> x;
      r[x] = 1;
    } else {
      cin >> x >> y;
      r[x] = r[y] = 1;
    }
  }
  x = y = 0;
  for (int i = 0; i < k; i++)
    if (!r[i]) x++;
  for (int i = 0; i < k; i++)
    if (!r[i]) {
      y++;
      r[i + 1] = 1;
    }
  cout << y << " " << x;
  return 0;
}
