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