Ruby: 4139 bytes
->(s>s,m){(0...s*s).reduce(0){|a,b|a+m**b}}
Test:
f = ->(s>s,m){(0...s*s).reduce(0){|a,b|a+m**b}}
f[8,2] # 18446744073709551615
f[3,6] # 2015539
f[7,1.5] # 850161998.2853994
f[5,-3] # 211822152361
f[256,1] # 65536
f[2,2] # 15
f[2,-2] # -5
f[1,1] # 1