find the longest subsequence of two array