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