See the FAQ for a thorough explanation.
You'll find out that your p are either zero, negative, or some fractional number, not integers.
p(i) and p(j) need to be integers and they aren't.
They are the row and column index of d so they must be integers like 1,2,3,4, etc. Not -37, not 0, not 3.1415. There is no -37th row of any matrix.
Maybe you can just round them, but who knows -- you'll have to figure that out. Why did you expect them to be integers greater than 1? But for some reason, they are not that.