print((function (M) M.cdef 'int scanf(const char*, ...);' local C,c,a,n = M.C,M.new("char[1]"),{} C.scanf("%d",c) n=c[0] for i=1,n do a[i]=n+1-i end C.scanf("%d",c) for _=1,c[0] do C.scanf("%d",c) local t=a[n+1-c[0]] for i=n+1-c[0],n-1 do a[i]=a[i+1] end a[n]=t end return a[n] end)(require'ffi'))