#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k, c, c1, min = 0, max = 0;
  vector<int> v(5000, 0);
  int temp;
  cin >> x >> k;
  for (int i = 1; i <= k; i++) {
    cin >> temp;
    if (temp == 2) {
      cin >> c;
      v[c] = 1;
    } else {
      cin >> c;
      cin >> c1;
      v[c] = 1;
      v[c1] = 1;
    }
  }
  v[x] = 1;
  for (int i = 1; i <= x - 1; i++) {
    if ((v[i] == 0) && (v[i + 1] == 0)) {
      min++;
      max += 2;
      v[i] = 1;
      v[i + 1] = 1;
    } else {
      if (v[i] == 0) {
        max++;
        min++;
        v[i] = 1;
      }
    }
  }
  cout << min << ' ' << max;
  return 0;
}
