#include<iostream> #include<stdio.h> #include<algorithm> #define MAXN 105 using namespace std; int a[MAXN]; bool Binarry_search(int a[],int size,int num); bool binarry_search(int a[],int num,int low,int high); int main() { //freopen("acm.acm","r",stdin); int cous; int cate; int c; int r; int i; int j; int tem; int test; bool boo; while(scanf("%d%d",&cous,&cate),cous) { boo = false; test = 0; for(i = 0; i < cous; ++ i) { scanf("%d",&a[i]); } sort(a,a+cous); for(i = 0;i < cate; ++ i) { scanf("%d%d",&c,&r); for(j = 0; j < c; ++ j) { scanf("%d",&tem); if(binarry_search(a,tem,0,cous-1)) ++ test; } if(test < r) { boo = true; } test = 0; } if(!boo) cout<<"yes"<<endl; else cout<<"no"<<endl; } } //////////////////////////////////////////////////////////////////////////////////////// //· Binarry_search_algorithm ·// //////////////////////////////////////////////////////////////////////////////////////// bool Binarry_search(int a[],int size,int num) { int i; int low = 0; int high = size -1; int mid; while(low <= high) { mid = (low + high)/2; if(num < a[mid]) { high = mid - 1; } else if(num > a[mid]) { low = mid + 1; } else return true; } return false; } bool binarry_search(int a[],int num,int low,int high) { int mid; mid = (low + high)/2; if(low > high) return false; if(num < a[mid]) binarry_search(a,num,low,mid - 1); else if(num > a[mid]) binarry_search(a,num,mid + 1,high); else return true; }