#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int x,k; cin >> x >> k; vector<bool> num(x+1, false); num[x] = true; for(int i = 0 ; i < k ; ++ i){ int index, num1,num2; cin >> index; if( index == 1){ cin >> num1 >> num2; num[num1]=num[num2] = true; }else{ cin >> num1; num[num1] = true; } } int maxNumber = count(num.begin()+1,num.end(),false); int minNumber = 0; for(int i = 1; i < x; ++ i){ if(!num[i]&&!num[i+1]){ minNumber++;++i;} else if( !num[i] && num[i+1]) minNumber++; } cout<< minNumber << " "<<maxNumber<<endl; }