using those verification lines of code and deleting the first for loop gives me what I want and looks like this:
K =
1 1 1 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0
1 1 2 1 1 0 0 0 0
0 0 1 1 1 0 0 0 0
0 0 1 1 2 1 1 0 0
0 0 0 0 1 1 1 0 0
0 0 0 0 1 1 2 1 1
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 1 1 1