Step 1: Identify possible points of non-differentiability.
The function is defined in different pieces. Therefore, possible points of non-differentiability occur at the joining points:
\[
x=-\sqrt5
\]
and
\[
x=\sqrt5.
\]
For all other intervals, the function is either constant or polynomial, so it is differentiable there.
Step 2: Check differentiability at \(x=-\sqrt5\).
For
\[
x\lt -\sqrt5,
\]
\[
f(x)=4.
\]
So, the left hand derivative is
\[
f'_-\left(-\sqrt5\right)=0.
\]
For
\[
-\sqrt5\leq x\leq \sqrt5,
\]
\[
f(x)=x^2-1.
\]
So,
\[
f'(x)=2x.
\]
Hence, the right hand derivative at
\[
x=-\sqrt5
\]
is
\[
f'_+\left(-\sqrt5\right)=2(-\sqrt5)=-2\sqrt5.
\]
Since
\[
0\neq -2\sqrt5,
\]
\(f(x)\) is not differentiable at
\[
x=-\sqrt5.
\]
Step 3: Check differentiability at \(x=\sqrt5\).
For
\[
-\sqrt5\leq x\leq \sqrt5,
\]
\[
f(x)=x^2-1.
\]
So,
\[
f'(x)=2x.
\]
Hence, the left hand derivative at
\[
x=\sqrt5
\]
is
\[
f'_-\left(\sqrt5\right)=2\sqrt5.
\]
For
\[
x\gt \sqrt5,
\]
\[
f(x)=4.
\]
So, the right hand derivative is
\[
f'_+\left(\sqrt5\right)=0.
\]
Since
\[
2\sqrt5\neq 0,
\]
\(f(x)\) is not differentiable at
\[
x=\sqrt5.
\]
Step 4: Find the value of \(k\).
The function is not differentiable at two points:
\[
x=-\sqrt5
\]
and
\[
x=\sqrt5.
\]
Therefore,
\[
k=2.
\]
Now,
\[
k-2=2-2=0.
\]
Step 5: Final conclusion.
Therefore,
\[
\boxed{0}
\]