n,m = map(int,input().split())

a = [int(x) for x in input()]



def solve(n,now,ls,cnt):
    if n == now:
        return cnt
    elif n-1 == now:
        return cnt
    else:
        pass

    if now+1 in ls and now+2 in ls:
        return 0
    elif   now+1 in ls:
        return solve(n,now+2,ls,cnt)
    elif   now+2 in ls:
        return solve(n,now+1,ls,cnt)
    else:
        return solve(n,now+2,ls,cnt*2)

ans = solve(n,0,a,1)

print(ans%(1000000007))