import static java.util.Arrays.fill;

import java.io.*;
import java.util.*;
/**
 * Correct dynamic programming solution. Works in O(n^2) time. 
 * 
 * @author niyaz.nigmatullin
 *
 */
public class operators_nn {

	static final int MOD = 1000000007;
	static final String PROBLEM_ID;
	static {
		String s = new Throwable().getStackTrace()[0].getClassName();
		PROBLEM_ID = s.substring(0, s.indexOf('_'));
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(new File(PROBLEM_ID + ".in"));
		PrintWriter out = new PrintWriter(PROBLEM_ID + ".out");
		int n = sc.nextInt();
		int m = sc.nextInt();
		n <<= 1;
		boolean[][] canPut = new boolean[n][];
		for (int i = 0; i < n; i++) {
			canPut[i] = new boolean[i + 1];
			fill(canPut[i], (i & 1) == 1 ? false : true);
		}
		for (int i = 0; i < m; i++) {
			int x = (n >> 1) - sc.nextInt();
			int y = sc.nextInt() - 1;
			canPut[2 * x][y] = false;
		}
		out.println(solveFast(n, canPut));
		out.close();
	}

	static int solveFast(int n, boolean[][] canPut) {
		int[][] dp = new int[n + 1][];
		for (int i = 0; i <= n; i++) {
			dp[i] = new int[n - i + 1];
		}
		int answer = 1;
		int current = 1;
		for (int i = 1; i <= n; i++) {
			int last = n - i;
			dp[i][last] = dp[i - 1][last];
			current = add(current, dp[i][last]);
			int z = current;
			for (int j = n - 2, k = last - 1; k >= 0; j--, k--) {
				if (canPut[j][i - 1]) {
					answer = add(answer, z);
					dp[i][k] = add(dp[i][k], z);
				}
				dp[i][k] = add(dp[i][k], dp[i - 1][k]);
				z = add(z, dp[i - 1][k]);
			}
		}
		return answer;
	}

	static int sub(int a, int b) {
		a -= b;
		if (a < 0) {
			a += MOD;
		}
		return a;
	}

	static int add(int a, int b) {
		a += b;
		if (a >= MOD) {
			a -= MOD;
		}
		return a;
	}
}
