#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k, op, val1, val2;
  while (cin >> x >> k) {
    int mini = 0, maxi = 0;
    maxi = x - 1;
    vector<int> T(4005);
    for (int i = 0; i < k; ++i) {
      cin >> op;
      if (op == 2) {
        cin >> val1;
        T[val1] = 1;
      } else {
        cin >> val1 >> val2;
        T[val1] = T[val2] = 1;
      }
      if (op == 2)
        maxi--;
      else
        maxi -= 2;
    }
    T[x] = 1;
    for (int i = 1; i <= x; ++i)
      if (T[i] == 0) {
        int ind;
        for (int j = i; j <= x; ++j)
          if (T[j] == 0)
            ind = j;
          else
            break;
        mini += ((ind - i + 1) - 1) / 2 + 1;
        i = ind;
      }
    cout << mini << " " << maxi << endl;
  }
}
