nt main()
{
    int n, q, a, b;
    scanf("%d%d", &n, &q);
    for(int i=0; i<n; i++){
        scanf("%d", &a);
    }
    for(int j=0; j<q; j++){
        scanf("%d", &b);
    }
    char someStringa[] = a;
    char someStringb[] = b;
    if(n%2!=0){
        if(someStringa[n/2+1]=someStringb[q]){
            printf("%d", 0);
        }
    }
}