clipping_value = -1
tmp = np.append(b, [[clipping_value], [clipping_value]], axis=1)
tmp[zip(*[((x, y) if x < b.shape[0] and y < b.shape[1] else (0, b.shape[1])
    ) for x, y in zip(a.transpose()[0], a.transpose()[1])])]
Numpy 2D array indexing without out of bound and with clipping value