#include <bits/stdc++.h>
using namespace std;
int aa[4005];
int main() {
  ios::sync_with_stdio(false);
  memset(aa, 0, sizeof(aa));
  int x, k;
  cin >> x >> k;
  while (k--) {
    int a;
    cin >> a;
    if (a == 1) {
      int b;
      int c;
      cin >> b >> c;
      aa[b] = 1;
      aa[c] = 1;
    }
    if (a == 2) {
      int b;
      cin >> b;
      aa[b] = 1;
    }
  }
  int smax = 0;
  int smin = 0;
  aa[0] = 1;
  for (int i = 1; i < x; ++i) {
    if (aa[i] == 0) smax++;
    if (aa[i] == 0 && aa[i - 1] == 0) {
      smin++;
      aa[i] = 1;
      aa[i - 1] = 1;
      continue;
    }
    if (i < x - 1) {
      if (aa[i] == 0 && aa[i + 1] != 0) {
        smin++;
        aa[i] = 1;
      }
    } else if (i == x - 1) {
      if (aa[i] == 0) smin++;
    }
  }
  cout << smin << ' ' << smax << endl;
  return 0;
}
