Counting number pair (i,j)

I’m from VietNam.

I have a problems :

A [1…n]
B [1…n] a[i], b[i] <= |10^9|
and K
Questions : How many pair (i,j) 1 <= i, j <= n | a[i] + b[j] = K ?

Help me solve problem in O(n)