def diff(a1, a2, shift):
    """
    Compute the diff after shifting array a2 by shift
    """
    if len(a1) != len(a2):
        raise ValueError("Diff, input arrays must be same length, got {} and {}".format(len(a1), len(a2)))
    return a1[:(-shift)] - a2[shift:]