M=10**9+7 n,m=gets.split.map &:to_i;r=0;s=[*0..n/m] (2..n/m).each{|i|s[i]==i&&i.step(n/m,i){|j|s[j]=s[j]/i*~-i};r+=s[i]} r*=2;(2..n-2).each{|i|r=r*i%M} p r