PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000078. Đếm số có ít nhất k ước nguyên tố (030 - K Factors)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đếm số có ít nhất k ước nguyên tố (030 - K Factors)

030 - K Factors

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given integers NN and KK, consider for every integer xx from 22 through NN the number of its distinct prime divisors. Count how many such integers have at least KK distinct prime divisors. Repeated occurrences of a prime factor count only once; e.g. 12=22⋅312=2^2\cdot3 has two distinct prime divisors.

Input

One line contains integers NN and KK.

Output

Print the count of integers xx with 2≤x≤N2\le x\le N and at least KK distinct prime divisors.

Subtasks

  • Subtask 1 (20 points): 2≤N≤10002\le N\le 1000; 1≤K≤81\le K\le8.
  • Subtask 2 (30 points): 2≤N≤1000002\le N\le 100000; 1≤K≤81\le K\le8.
  • Subtask 3 (50 points): 2≤N≤100000002\le N\le 10000000; 1≤K≤81\le K\le8.

Examples

Input

15 2

Output

5

Explanation

The values at most 1515 with at least two distinct prime divisors are 6=2⋅36=2\cdot3, 10=2⋅510=2\cdot5, 12=22⋅312=2^2\cdot3, 14=2⋅714=2\cdot7, and 15=3⋅515=3\cdot5. There are five such numbers, so print 5.