program main
      implicit none
      integer(4) :: n, k, x, y
      integer(8) :: cnt
      integer(4), allocatable :: a(:)

      read *, n, k
      allocate( a(k) )

      do x = k, 1, -1
        a(x) = (k/x)**n
        do y = 2, k/x
          a(x) = a(x)-a(y*x)
        end do
      end do

      cnt = 0
      do x = 1, k
        cnt = cnt + x * a(x)
      end do

      print *, mod(cnt,(10**9 + 7))

end program main
