#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int flag[4100];
int main() {
  int first, k;
  scanf("%d%d", &first, &k);
  while (k--) {
    int a, b, c;
    scanf("%d", &a);
    if (a == 1) {
      scanf("%d%d", &b, &c);
      flag[b] = 1;
      flag[c] = 1;
    } else {
      scanf("%d", &b);
      flag[b] = 1;
    }
  }
  int ma = 0, na = 0;
  int nn = 0;
  flag[first] = 1;
  for (int i = 1; i <= first; i++) {
    if (flag[i] == 0) {
      nn++;
      ma++;
    } else {
      if (nn % 2 == 0)
        na += (nn / 2);
      else
        na += (nn + 1) / 2;
      nn = 0;
    }
  }
  cout << na << ' ' << ma << endl;
}
