This page is still under construction.

Parts of this page are still being built. What you see may change.

Miner

Time limit1sMemory limit256 MB

Summary
Given n intervals and m points, count the nonempty subsets of intervals whose intersection contains at least one of the given points, modulo 998244353.
Level

Hard8 of 10

Topics
Intervals, Sorting, Combinatorics, Two pointers
Solved
No attempts yet

Problem

There are nn different minerals in a mine cave. The mine cave can be regarded as a coordinate axis, and the ii-th mineral can be mined from any position in the range [li,ri][l_i, r_i].

You are a miner in this mine cave. On each day, the foreman gives you a task of mining minerals. A task is a non-empty set of different minerals (there are 2n−12^n - 1 different tasks), and your goal is to collect all minerals in this set.

There are mm safe positions aia_i in the mine cave. A task is easy if and only if you can select a safe position apa_p and find all required minerals there.

Now, you want to count the number of easy tasks.

Input

The first line contains two integers nn and mm (1≤n,m≤1051 \le n, m \le 10^5).

Then nn lines follow. Each of them contains two integers lil_i and rir_i (1≤li≤ri≤1091 \le l_i \le r_i \le 10^9).

Then mm lines follow. Each of them contains a single integer aia_i (1≤ai≤1091 \le a_i \le 10^9).

Output

Output a single line with a single integer: the number of easy tasks modulo 998 244 353998\,244\,353.

Examples1

  1. Example 1

    Input
    3 2
    7 11
    1 5
    3 8
    4
    7
    
    Expected output
    5