static int process(String line) {
		int[] arr = giveArray(line.trim().split(" "));
		if(arr.length == 1 && arr[0] == 0)
			return 0;
		
		int n = arr[0], c = arr[1];
		String[] chosen = readLine().trim().split(" ");
		boolean[] mp = new boolean[10002];
		for(String s : chosen) {
			mp[Integer.parseInt(s)] = true;
		}
		boolean fail = false;
		for(int i = 0; i < c; i++) {
			int[] cat = giveArray(readLine().trim().split(" "));
			int min = cat[1];
			for(int j = 2; j < 2 + cat[0]; j++) {
				if(mp[cat[j]])
					min--;
			}
			if(min > 0)
				fail = true;
		}
		System.out.println(fail ? "no" : "yes");
		return 1;
	}