Finding correct values based on information from two arrays
This is a fairly easy task. The reason is that your signals are monotonically increasing and encode the same additively evolving time information. 
First of all, I suggest you subtract 2 from B. Then what you do is:

1) Start at position 0 on A and position 0 on B and maintain 2 separate indices (say $i$ and $j$) for traversing A and B.

2) Compare current values of $A$ and $B$: $A_i$ and $B_j$.

3) The moment where $A_i &gt; B_j$ increase $i$ : $i=i+1$.

4) The moment where $B_j &lt; A_i$ increase $j$ : $j=j+1$.

5) The moment where $B_j = A_i$ you have a beep. Increase both indices.

6) Goto step 2 and repeat until you reach the end.