#include using namespace std; typedef long long ll; typedef pair l_l; typedef pair i_i; template inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } const long long INF = 1e18; //const ll mod = 1000000007; ll MAX_N = 1e5; ll MAX_M = 1e5; ll MAX_B = 1e9; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, M; cin >> N >> M; assert(1 <= N and N <= MAX_N); assert(0 <= M and M <= MAX_M); for(int i = 0; i < N; i++) { ll B; cin >> B; assert(-MAX_B <= B and B <= MAX_B); } set st; for(int i = 0; i < M; i++) { ll l, r; cin >> l >> r; assert(1 <= l and l <= r and r <= N); l_l tmp = {l, r}; assert(st.find(tmp) == st.end()); st.insert(tmp); } return 0; }