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

#BS0000345. Lập kế hoạch chuyến thám hiểm (Planning The Expedition)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Lập kế hoạch chuyến thám hiểm (Planning The Expedition)

Planning The Expedition

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

An expedition has n participants and m single-use daily food packages. Package i has type aia_i. Each participant consumes one package daily and must keep the same food type throughout. Different participants may share a type. Maximize the expedition duration.

Input

First line: n,mn,m. Second line: mm integers aia_i.

Output

Print the maximum number of days, or 0 if even one day is impossible.

Subtasks

  • Subtask 1 (20 points): 1≤n,m≤101\le n,m\le10; 1≤ai≤1001\le a_i\le100.
  • Subtask 2 (30 points): 1≤n,m≤1001\le n,m\le100; 1≤ai≤1001\le a_i\le100; all packages have the same type.
  • Subtask 3 (50 points): 1≤n,m≤1001\le n,m\le100; 1≤ai≤1001\le a_i\le100.

Examples

Input 1

4 10
1 5 2 1 1 1 2 5 7 2

Output 1

2

Explanation

Type 1 has four packages, type 2 three, type 5 two. Assign two people type 1 and one each types 2 and 5 for two days. Three days require at least twelve packages.

Input 2

3 2
1 1

Output 2

0

Explanation

There are not enough packages for one day.