#include using namespace std; #include #include #include #include #include struct FastIO { FastIO() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); } }; inline FastIO fast_io_init; template std::istream& operator>>(std::istream& is, std::vector& v); template std::istream& operator>>(std::istream& is, std::pair& p) { return is >> p.first >> p.second; } template void read_tuple_impl(std::istream& is, Tuple& t, std::index_sequence) { (..., (is >> std::get(t))); } template std::istream& operator>>(std::istream& is, std::tuple& t) { read_tuple_impl(is, t, std::index_sequence_for{}); return is; } template std::istream& operator>>(std::istream& is, std::vector& v) { for (auto& elem : v) { is >> elem; } return is; } using default_type = long; template void read(Args&... args) { (std::cin >> ... >> args); } template T read_val() { T val; std::cin >> val; return val; } template std::pair read_pair() { std::pair p; std::cin >> p; return p; } template std::tuple read_tuple() { std::tuple t; std::cin >> t; return t; } template std::vector read_vec(int n) { std::vector v(n); std::cin >> v; return v; } template std::vector read_vec() { int n; std::cin >> n; return read_vec(n); } template std::vector> read_vec_pair(int n) { std::vector> v(n); std::cin >> v; return v; } template std::vector> read_vec_pair() { int n; std::cin >> n; return read_vec_pair(n); } template std::vector> read_vec_tuple(int n) { std::vector> v(n); std::cin >> v; return v; } template std::vector> read_vec_tuple() { int n; std::cin >> n; return read_vec_tuple(n); } template std::vector> read_vec_grid(int h, int w) { std::vector> grid(h, std::vector(w)); std::cin >> grid; return grid; } template std::vector> read_vec_grid() { int h, w; std::cin >> h >> w; return read_vec_grid(h, w); } template std::vector> read_vec_var(int n) { std::vector> res(n); for (int i = 0; i < n; ++i) { int m; std::cin >> m; res[i] = read_vec(m); } return res; } template std::vector> read_vec_var() { int n; std::cin >> n; return read_vec_var(n); } template T read_zero_idx() { T val; std::cin >> val; return val - 1; } inline std::vector> read_graph(int n, int m, bool directed = false) { std::vector> g(n); for (int i = 0; i < m; ++i) { int u = read_zero_idx(); int v = read_zero_idx(); g[u].push_back(v); if (!directed) { g[v].push_back(u); } } return g; } inline std::vector> read_graph(bool directed = false) { int n, m; std::cin >> n >> m; return read_graph(n, m, directed); } #include #include #include #include #define ALL(a) (a).begin(), (a).end() using i128 = __int128; template inline bool chmin(T& a, const U& b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, const U& b) { if (a < b) { a = b; return true; } return false; } template inline T div_ceil(T a, T b) { if (a > 0) return a / b + (a % b != 0); return a / b; } template inline T div_floor(T a, T b) { if (a < 0) return a / b - (a % b != 0); return a / b; } template inline T mod(T a, T m) { a %= m; if (a < 0) a += m; return a; } template inline constexpr T INF = std::numeric_limits::max() / 2; template <> inline constexpr float INF = std::numeric_limits::infinity(); template <> inline constexpr double INF = std::numeric_limits::infinity(); template <> inline constexpr long double INF = std::numeric_limits::infinity(); template inline std::vector iota_vec(int n, T start = 0) { std::vector v(n); std::iota(v.begin(), v.end(), start); return v; } template inline std::vector doubled_vec(const std::vector& v) { std::vector res; res.reserve(v.size() * 2); res.insert(res.end(), v.begin(), v.end()); res.insert(res.end(), v.begin(), v.end()); return res; } inline void Yes(bool b = true) { std::println("{}", (b ? "Yes" : "No")); } inline void No() { std::println("No"); } #ifdef LOCAL #include #else #define debug(...) #endif void solve() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M; read(N, M); auto A = read_vec(N); auto B = read_vec(M); int ans = 0; for (auto& a : A) { a--; if (B[a] > 0) B[a]--; else ans++; } println("{}", ans); } int main() { solve(); }