n,K=map(int,input().split()) a=list(map(int,input().split())) z=[0,10**10]+a z=sorted(set(z)) d={v:i for i,v in enumerate(z)} for i in range(n): a[i]=d[a[i]] s=input() q=[[0]*(K+2) for i in range(n)] for i in range(n): q[i][1]=1 M=10**9+7 B=40 for j in range(2,K+2): st1=[0]*B*B st2=[0]*B for i in range(n): if s[j-2]=="<": l=0 r=a[i]-1 if s[j-2]==">": l=a[i]+1 r=len(z)-1 yl=l//B yr=r//B if yl==yr: q[i][j]+=sum(st1[l:r+1]) else: q[i][j]+=sum(st1[l:yl*B+B]) q[i][j]+=sum(st2[yl+1:yr]) q[i][j]+=sum(st1[yr*B:r+1]) q[i][j]%=M st1[a[i]]+=q[i][j-1] st1[a[i]]%=M st2[a[i]//B]+=q[i][j-1] st2[a[i]//B]%=M print(sum(q[i][K+1] for i in range(n))%M)