Is the following proof valid?

Theorem.

If m is a positive odd integer such that 2m ≡ 2 (mod. m(m-1)) then m ≡ 3 (mod. 4) and m is a prime.

Proof.

Let 2m ≡ 2 (mod. m(m-1)) then 2m - 2 =km(m-1) for some positive integer k.

This gives 2m-1 – 1 = km(m-1)/2 and since 2m-1 – 1 is odd, (m-1)/2 is odd implying m ≡ 3 (mod. 4).

Let p be the least valued prime dividing (m-1)/2 . Then p is odd and 2m-1 ≡ 1 (mod. p).

Let d be the order of 2 (mod. p).

Then d is a positive integer < p and 2d ≡ 1 (mod. p).

So d divides (m-1) and d divides (p-1).

This implies there is a prime dividing d, less than p, which divides (m-1)/2 .

This contrdicts p is the least valued prime dividing (m-1)/2 .

Hence, m is a prime.