n,q=map(int,input().split()) a=list(map(int,input().split())) b=[0]*(n+1)+[0] for i in range(n): if a[i]: b[i]+=1 b[i+1]-=1 for i in range(q): l,r=map(int,input().split()) l-=1 r-=1 b[l]+=1 b[r+1]-=1 for i in range(n): b[i]+=b[i-1] b[i]%=2 print(*b[:n])