When a line and a curve are tangent to each other, they are joined together by 1 point (x,y). So, you equate both equations either in terms of x or y. For this problem, let's equate in terms of y.
y = k - x y = x² + 3x + 1
k - x = x² + 3x + 1 k = x² + 3x + x + 1 k = x² + 4x + 1
This would be the value of k. Since we are not given the common point, it can only be expressed in terms of x or y.