You are given an array $a$ of length $n$.

You are also given a set of distinct positions $p_1, p_2, \dots, p_m$, where $1 \le p_i < n$. The position $p_i$ means that you can swap elements $a[p_i]$ and $a[p_i + 1]$. You can apply this operation any number of times for each of the given positions.

Your task is to determine if it is possible to sort the initial array in non-decreasing order ($a_1 \le a_2 \le \dots \le a_n$) using only allowed swaps.

For example, if $a = [3, 2, 1]$ and $p = [1, 2]$, then we can first swap elements $a[2]$ and $a[3]$ (because position $2$ is contained in the given set $p$). We get the array $a = [3, 1, 2]$. Then we swap $a[1]$ and $a[2]$ (position $1$ is also contained in $p$). We get the array $a = [1, 3, 2]$. Finally, we swap $a[2]$ and $a[3]$ again and get the array $a = [1, 2, 3]$, sorted in non-decreasing order.

You can see that if $a = [4, 1, 2, 3]$ and $p = [3, 2]$ then you cannot sort the array.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 100$) — the number of test cases.

Then $t$ test cases follow. The first line of each test case contains two integers $n$ and $m$ ($1 \le m < n \le 100$) — the number of elements in $a$ and the number of elements in $p$. The second line of the test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 100$). The third line of the test case contains $m$ integers $p_1, p_2, \dots, p_m$ ($1 \le p_i < n$, all $p_i$ are distinct) — the set of positions described in the problem statement.


-----Output-----

For each test case, print the answer — "YES" (without quotes) if you can sort the initial array in non-decreasing order ($a_1 \le a_2 \le \dots \le a_n$) using only allowed swaps. Otherwise, print "NO".


-----Example-----
Input
6
3 2
3 2 1
1 2
4 2
4 1 2 3
3 2
5 1
1 2 3 4 5
1
4 2
2 1 4 3
1 3
4 2
4 3 2 1
1 3
5 2
2 1 2 3 3
1 4

Output
YES
NO
YES
YES
NO
YES
[{"code": "for _ in range(int(input())):\n    n, m = list(map(int, input().split()))\n    l = list(map(int, input().split()))\n    p = set(map(int, input().split()))\n    for i in range(len(l)):\n        for j in range(len(l) - 1):\n            if l[j] > l[j + 1] and j + 1 in p:\n                l[j], l[j + 1] = l[j + 1], l[j]\n    ans = True\n    for i in range(len(l) - 1):\n        if l[i] > l[i + 1]:\n            ans = False\n            break\n    print('YES' if ans else 'NO')\n", "passed": true, "time": 0.15, "memory": 14164.0, "status": "done"}, {"code": "t = int(input())\nfor T in range(t):\n    n, m = list(map(int, input().strip().split()))\n    v = list(map(int, input().strip().split()))\n    u = [0] * n\n    for i in list(map(int, input().strip().split())):\n        u[i-1] = 1\n    for i in range(n):\n        j = i\n        while j > 0 and u[j-1] and v[j] < v[j-1]:\n            v[j], v[j-1] = v[j-1], v[j]\n            j -= 1\n    if v == sorted(v): print(\"YES\")\n    else: print(\"NO\")\n", "passed": true, "time": 0.15, "memory": 14252.0, "status": "done"}, {"code": "\nimport math\n\ndef rints():\n    return list(map(int,input().split()))\n\n\nt = int(input())\nfor _ in range(t):\n    n,m = rints()\n    a = rints()\n    p = rints()\n\n    for _ in range(100):\n        for pi in p:\n            if a[pi-1] > a[pi]:\n                a[pi], a[pi-1] = a[pi-1], a[pi]\n\n    print(\"YES\" if sorted(a[:]) == a else \"NO\")\n\n", "passed": true, "time": 0.15, "memory": 14080.0, "status": "done"}, {"code": "t = int(input())\nfor _ in range(t):\n    n, m = list(map(int, input().split()))\n    a = list(map(int, input().split()))\n    p = set(list(map(int, input().split())))\n    for i in range(n):\n        for j in range(0, n - i - 1):\n            if a[j] > a[j + 1] and j + 1 in p:\n                a[j], a[j + 1] = a[j + 1], a[j]\n    if a == sorted(a):\n        print(\"YES\")\n    else:\n        print(\"NO\")", "passed": true, "time": 0.15, "memory": 14352.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n, m = map(int, input().split())\n    a = list(map(int, input().split()))\n    p = list(map(lambda x: int(x) - 1, input().split()))\n\n    b = sorted(a)\n    c = a.copy()\n\n    while True:\n        for i in p:\n            if a[i] > a[i + 1]:\n                a[i], a[i + 1] = a[i + 1], a[i]\n\n        if a == b:\n            print('YES')\n            break\n\n        if a == c:\n            print('NO')\n            break\n\n        c = a.copy()", "passed": true, "time": 0.14, "memory": 14136.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    a, b = map(int, input().split())\n    s = list(map(int, input().split()))\n    p = list(map(int, input().split()))\n    i = 0\n    check = 1\n    ans = True\n    while i != len(s) - check:\n        if s[i] > s[i + 1]:\n            s[i], s[i + 1] = s[i + 1], s[i]\n            if i + 1 not in p:\n                ans = False\n            if i == 0:\n                i -= 1\n            else:\n                i -= 2\n        i += 1\n    if ans:\n        print('YES')\n    else:\n        print('NO')", "passed": true, "time": 0.95, "memory": 14300.0, "status": "done"}, {"code": "import sys\nimport math\nimport itertools\nimport functools\nimport collections\nimport operator\nimport fileinput\n\ndef ii(): return int(input())\ndef mi(): return list(map(int, input().split()))\ndef li(): return list(map(int, input().split()))\ndef lcm(a, b): return abs(a * b) // math.gcd(a, b)\ndef revn(n): return str(n)[::-1]\ndef dd(): return collections.defaultdict(int)\ndef ddl(): return collections.defaultdict(list)\ndef sieve(n):\n    if n < 2: return list()\n    prime = [True for _ in range(n + 1)]\n    p = 3\n    while p * p <= n:\n        if prime[p]:\n            for i in range(p * 2, n + 1, p):\n                prime[i] = False\n        p += 2\n    r = [2]\n    for p in range(3, n + 1, 2):\n        if prime[p]:\n            r.append(p)\n    return r\ndef divs(n, start=2):\n    r = []\n    for i in range(start, int(math.sqrt(n) + 1)):\n        if (n % i == 0):\n            if (n / i == i):\n                r.append(i)\n            else:\n                r.extend([i, n // i])\n    return r\ndef divn(n, primes):\n    divs_number = 1\n    for i in primes:\n        if n == 1:\n            return divs_number\n        t = 1\n        while n % i == 0:\n            t += 1\n            n //= i\n        divs_number *= t\ndef prime(n):\n    if n == 2: return True\n    if n % 2 == 0 or n <= 1: return False\n    sqr = int(math.sqrt(n)) + 1\n    for d in range(3, sqr, 2):\n        if n % d == 0: return False\n    return True\ndef convn(number, base):\n    newnumber = 0\n    while number > 0:\n        newnumber += number % base\n        number //= base\n    return newnumber\ndef cdiv(n, k): return n // k + (n % k != 0)\n\n\nfor _ in range(ii()):\n    n, m = mi()\n    a = li()\n    b = sorted(a)\n    p = li()\n    for _ in range(n):\n        for i in range(m):\n            if a[p[i] - 1] > a[p[i]]:\n                a[p[i] - 1], a[p[i]] = a[p[i]], a[p[i] - 1]\n    if a == b:\n        print('YES')\n    else:\n        print('NO')\n", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "t=int(input())\nwhile t:\n    n,m=map(int,input().split())\n    a=input().split()\n    p=input().split()\n    for i in range(n):\n        a[i]=int(a[i])\n    visited=[0 for i in range(n)]    \n    for i in range(m):\n        visited[int(p[i])]=1\n    ls=[]\n    temp=[]\n    for i in range(n):\n        if(visited[i]==0):\n            temp.sort()\n            for j in range(len(temp)):\n                ls.append(temp[j])\n            temp=[a[i]]\n        else:\n            temp.append(a[i])\n    temp.sort()\n    for j in range(len(temp)):\n        ls.append(temp[j])\n    a.sort()\n    if(a==ls):print(\"YES\")\n    else:print(\"NO\")\n    t-=1    ", "passed": true, "time": 0.14, "memory": 14388.0, "status": "done"}, {"code": "t = int(input())\n\nfor _ in range(t):\n    n, m = [int(x) for x in input().split()]\n    a = [int(x) for x in input().split()]\n    p = list(sorted([int(x) for x in input().split()]))\n    \n    for _ in range(n + 2):\n        for pos in p:\n            if a[pos-1] > a[pos]:\n                a[pos-1], a[pos] = a[pos], a[pos-1]\n    \n    if a == list(sorted(a)):\n        print(\"YES\")\n    else:\n        print(\"NO\")\n", "passed": true, "time": 0.15, "memory": 14408.0, "status": "done"}, {"code": "t=int(input())\nwhile(t):\n        t-=1\n        n,m=list(map(int,input().split()))\n        a=list(map(int,input().split()))\n        p=list(map(int,input().split()))\n        p=set(p)\n        for i in range(n):\n                for j in range(0,n-i-1):\n                        if(a[j]>a[j+1] and j+1 in p):\n                                a[j],a[j+1]=a[j+1],a[j]\n        flag=0\n        mi=-1000\n        for i in range(n):\n                if(mi<=a[i]):\n                        mi=a[i]\n                        continue\n                flag=1\n        if(flag==1):\n                print(\"NO\")\n        else:\n                print(\"YES\")\n", "passed": true, "time": 1.04, "memory": 14088.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n, m = list(map(int, input().split()))\n    A = list(map(int, input().split()))\n    B = list(map(int, input().split()))\n    B.sort()\n    k = [B[0] - 1]\n    for i in range(1, m):\n        if B[i - 1] + 1 == B[i]:\n            k.append(B[i] - 1)\n        else:\n            if k:\n                k.append(k[-1] + 1)\n                x = A[k[0]:k[-1] + 1]\n                x.sort()\n                A[k[0]:k[-1] + 1] = x\n                k = [B[i] - 1]\n    k.append(B[-1] - 1)\n    k.append(k[-1] + 1)\n    x = A[k[0]:k[-1] + 1]\n    x.sort()\n    A[k[0]:k[-1] + 1] = x\n    if A == sorted(A):\n        print('YES')\n    else:\n        print('NO')\n", "passed": true, "time": 0.17, "memory": 14184.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n, m = map(int, input().split())\n    l = [*map(int, input().split())]\n    p = sorted([*map(int, input().split())])\n    for _ in range(n):\n        for i in p:\n            l[i - 1], l[i] = sorted(l[i - 1 : i + 1])\n    print(['NO', 'YES'][l == sorted(l)])", "passed": true, "time": 0.22, "memory": 14084.0, "status": "done"}, {"code": "for eps in range(int(input())):\n    n, m = map(int, input().split())\n    a = list(map(int, input().split()))\n    b = list(map(int, input().split()))\n    check = [False] * n\n    for elem in b:\n        check[elem - 1] = True\n    b = sorted(a)\n    i = 0\n    k = 1\n    while i < len(a) - 1 and k != 0:\n        k = 0\n        i = i + 1\n        for j in range(len(a) - i):\n            if a[j] > a[j + 1] and check[j]:\n                k = k + 1\n                a[j], a[j + 1] = a[j + 1], a[j]\n    if a == b:\n        print(\"YES\")\n    else:\n        print(\"NO\")", "passed": true, "time": 0.23, "memory": 14152.0, "status": "done"}, {"code": "for nt in range(int(input())):\n\tn,m=list(map(int,input().split()))\n\tarr=list(map(int,input().split()))\n\tp=list(map(int,input().split()))\n\tif m>=n-1:\n\t\tprint (\"YES\")\n\t\tcontinue\n\tflag=0\n\tfor i in range(n): \n\t\tfor j in range(0, n-i-1): \n\t\t\tif arr[j] > arr[j+1] :\n\t\t\t\tif (j+1) not in p:\n\t\t\t\t\tflag=1\n\t\t\t\t\tbreak\n\t\t\t\tarr[j], arr[j+1] = arr[j+1], arr[j] \n\tif flag==1:\n\t\tprint (\"NO\")\n\telse:\n\t\tprint (\"YES\")\n", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n,m = list(map(int,input().split()))\n    arr = list(map(int,input().split()))\n    prr = list(map(int,input().split()))\n    for i in range(m):\n        prr[i]-=1\n    temp = arr[::]\n    temp.sort()\n    cnt = 0\n    f = 0\n    prev = arr[::]\n    while cnt<n**2:\n        for i in range(m):\n            x,y = prr[i],prr[i]+1\n            if arr[x]>arr[y]:\n                arr[x],arr[y] = arr[y],arr[x]\n                cnt+=1\n        if arr==temp:\n            f = 1\n            break\n        if prev==arr:\n            break\n        prev = arr[::]\n    if f==1:\n        print(\"YES\")\n    else:\n        print(\"NO\")\n", "passed": true, "time": 0.15, "memory": 14164.0, "status": "done"}, {"code": "t = int(input())\nfor _ in range(t):\n    n, m = list(map(int, input().split()))\n    a = list(map(int, input().split()))\n    p = set(map(int, input().split()))\n    for __ in range(len(a)):\n        for i in range(len(a)-1):\n            if a[i] > a[i + 1] and i+1 in p:\n                a[i], a[i + 1] = a[i + 1], a[i]\n    flag = True\n    for i in range(len(a)-1):\n        if a[i] > a[i + 1]:\n            print(\"NO\")\n            flag = False\n            break\n    if flag:\n        print(\"YES\")\n", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "q = int(input())\nfor rwre in range(q):\n\tn,m = list(map(int,input().split()))\n\tl = list(map(int,input().split()))\n\tll = l.copy()\n\tp = list(map(int,input().split()))\n\tp.sort()\n\ti = 0\n\twhile i < 100000:\n\t\ti += 1\n\t\tif l[p[i%m]-1] > l[p[i%m]]:\n\t\t\ta = l[p[i%m]-1]\n\t\t\tb = l[p[i%m]]\n\t\t\tl[p[i%m]-1] = b\n\t\t\tl[p[i%m]] = a\n\tll.sort()\n\tif l == ll:\n\t\tprint(\"YES\")\n\telse:\n\t\tprint(\"NO\")\n", "passed": true, "time": 0.32, "memory": 14124.0, "status": "done"}, {"code": "from sys import stdin\n\ndef solve():\n    n, m = map(int, input().split())\n    a = list(map(int, input().split()))\n    u = [0] * n\n    p = list(map(int, input().split()))\n    for x in p:\n        u[x-1] = 1\n    p = []\n    for i in range(n):\n        if u[i] == 0:\n            p.append(i)\n    pos = 0\n    prevmx = -1\n    curmx = -1\n    curmn = 101\n    for i in range(n):\n        curmn = min(a[i], curmn)\n        curmx = max(a[i], curmx)\n        if i == p[pos]:\n            if curmn < prevmx:\n                return print(\"NO\")\n            prevmx = curmx\n            curmx = -1\n            curmn = 101\n            pos += 1\n    print(\"YES\")\n\nfor i in range(int(input())):\n    solve()\n", "passed": true, "time": 0.15, "memory": 14032.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n, m = list(map(int, input().split()))\n    a = list(map(int, input().split()))\n    pos = sorted([int(x)-1 for x in input().split()]) + [10**9]\n\n    ans = sorted(a)\n    l = pos[0]\n    for i in range(m):\n        if pos[i]+1 < pos[i+1]:\n            a[l:pos[i]+2] = sorted(a[l:pos[i]+2])\n            l = pos[i+1]\n    if a == ans:\n        print('YES')\n    else:\n        print('NO')\n", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "for _ in range(int(input())):\n\tn,m=map(int,input().split())\n\tl=list(map(int,input().split()))\n\tpos=list(map(lambda x:int(x)-1,input().split()))\n\tz=sorted(list(l))\n\td={}\n\ts=set(pos)\n\tsor={}\n\tflag=\"YES\"\n\tfor i in range(n):\n\t\td[l[i]]=i\n\t\tsor[z[i]]=i\n\tfor i in range(n):\n\t\tfor j in range(min(d[l[i]],sor[l[i]]),max(d[l[i]],sor[l[i]])):\n\t\t\tif j not in s:\n\t\t\t\tflag=\"NO\"\n\tprint(flag)", "passed": true, "time": 0.14, "memory": 14184.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\n\nt=int(input())\n\nfor tests in range(t):\n    n,m=list(map(int,input().split()))\n    A=list(map(int,input().split()))\n    P=set(map(int,input().split()))\n\n    flag=1\n\n    for i in range(n):\n        top=i\n        for j in range(n-1,i,-1):\n            if A[i]>A[j]:\n                top=j+1\n                #print(i,top)\n                break\n        for j in range(i+1,top):\n            if j in P:\n                continue\n            else:\n                flag=0\n                break\n        if flag==0:\n            break\n\n    if flag:\n        print(\"YES\")\n    else:\n        print(\"NO\")\n\n    \n", "passed": true, "time": 0.14, "memory": 14092.0, "status": "done"}, {"code": "t=int(input())\nfor _ in range(t):\n    n,m=list(map(int,input().split()))\n    a=list(map(int,input().split()))\n    p=list(map(int,input().split()))\n    while 1:\n        b=a.copy()\n        for i in p:\n            if a[i-1]>a[i]:\n                a[i-1],a[i]=a[i],a[i-1]\n        #print(a)\n        if b==a:\n            break\n    b=a.copy()\n    b.sort()\n    if b==a:\n        print(\"YES\")\n    else:\n        print(\"NO\")\n", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}]