package main import ( "bufio" "fmt" "os" ) func main() { in := bufio.NewReader(os.Stdin) var N, K int ans := 1 fmt.Fscan(in, &N, &K) val := N - K list, m := soinsu(val, K) //fmt.Println(list, m) for i := 0; i < len(list); i++ { ans *= (m[list[i]] + 1) //fmt.Println(m[list[i]] + 1) } if K == 0 { ans += 1 } ans -= 1 fmt.Println(ans) } func soinsu(N, K int) ([]int, map[int]int) { list := make([]int, 0) m := make(map[int]int) for i := K + 1; i < N; i++ { if i*i > N { break } if N%i != 0 { continue } if i == 1 { continue } for N%i == 0 { if _, ok := m[i]; ok { m[i]++ } else { m[i] = 1 list = append(list, i) } N /= i } } if N != 1 && K < N { list = append(list, N) if _, ok := m[N]; ok { m[N]++ } else { m[N] = 1 } } return list, m }