A - 遊園地のアトラクション 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MiB

配点 : 233 点

問題文

高橋君を含む N 人のグループが遊園地にやってきました。この遊園地には M 個のアトラクションがあります。

グループのメンバーにはそれぞれ身長があり、メンバー j (1 \leq j \leq N) の身長は L_j cm です。また、各アトラクションには身長制限が設けられており、アトラクション i (1 \leq i \leq M) に乗るには身長が S_i cm 以上でなければなりません。すなわち、メンバー j がアトラクション i に乗れるのは L_j \geq S_i を満たすときに限ります。

高橋君は、グループの N 人全員が身長制限を満たして乗ることのできるアトラクションがいくつあるか知りたいと思っています。すなわち、すべてのメンバー j (1 \leq j \leq N) について L_j \geq S_i が成り立つようなアトラクション i の個数を求めてください。

制約

  • 1 \leq N \leq 2 \times 10^5
  • 1 \leq M \leq 2 \times 10^5
  • 1 \leq L_j \leq 300 (1 \leq j \leq N)
  • 1 \leq S_i \leq 300 (1 \leq i \leq M)
  • 入力はすべて整数

入力

N M
L_1 L_2 \ldots L_N
S_1 S_2 \ldots S_M
  • 1 行目には、グループの人数を表す整数 N と、アトラクションの数を表す整数 M が、スペース区切りで与えられる。
  • 2 行目には、各メンバーの身長(cm)を表す整数 L_1, L_2, \ldots, L_N が、スペース区切りで与えられる。
  • 3 行目には、各アトラクションの身長制限(cm)を表す整数 S_1, S_2, \ldots, S_M が、スペース区切りで与えられる。

出力

グループの N 人全員が乗ることのできるアトラクションの数を 1 行で出力してください。


入力例 1

3 4
150 140 160
130 150 145 170

出力例 1

1

入力例 2

5 6
120 135 128 140 132
110 125 130 140 135 150

出力例 2

1

入力例 3

10 8
165 172 158 180 169 175 162 170 168 155
150 160 155 170 165 180 145 175

出力例 3

3

Score : 233 pts

Problem Statement

A group of N people, including Takahashi, has come to an amusement park. This amusement park has M attractions.

Each member of the group has a certain height. The height of member j (1 \leq j \leq N) is L_j cm. Additionally, each attraction has a height restriction: to ride attraction i (1 \leq i \leq M), one must have a height of at least S_i cm. That is, member j can ride attraction i only when L_j \geq S_i is satisfied.

Takahashi wants to know how many attractions all N members of the group can ride while satisfying the height restrictions. In other words, find the number of attractions i such that L_j \geq S_i holds for every member j (1 \leq j \leq N).

Constraints

  • 1 \leq N \leq 2 \times 10^5
  • 1 \leq M \leq 2 \times 10^5
  • 1 \leq L_j \leq 300 (1 \leq j \leq N)
  • 1 \leq S_i \leq 300 (1 \leq i \leq M)
  • All inputs are integers.

Input

N M
L_1 L_2 \ldots L_N
S_1 S_2 \ldots S_M
  • The first line contains an integer N representing the number of people in the group and an integer M representing the number of attractions, separated by a space.
  • The second line contains integers L_1, L_2, \ldots, L_N representing the height (in cm) of each member, separated by spaces.
  • The third line contains integers S_1, S_2, \ldots, S_M representing the height restriction (in cm) of each attraction, separated by spaces.

Output

Print in one line the number of attractions that all N members of the group can ride.


Sample Input 1

3 4
150 140 160
130 150 145 170

Sample Output 1

1

Sample Input 2

5 6
120 135 128 140 132
110 125 130 140 135 150

Sample Output 2

1

Sample Input 3

10 8
165 172 158 180 169 175 162 170 168 155
150 160 155 170 165 180 145 175

Sample Output 3

3