#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n,m;

int main(){
    while(cin >> n >> m && n){
        ll MAX[10001] = {};
        ll MIN[10001] = {};
        rep(i,m){
            ll s,k;
            cin >> s >> k;
            rep(j,k){
                ll num;
                cin >> num;
                num--;
                if(k == 1)MIN[num] += s;
                MAX[num] += s;
            }
        }
        ll ans = 0;
        rep(i,n){
            rep(j,n){
                if(i != j)ans = max(ans,MAX[i] - MIN[j]);
            }
        }
        cout << ans + 1 << endl;
    }
}
