import java.io.*;
import java.util.*;

public class operators_vd {
	BufferedReader in;
	StringTokenizer str;
	PrintWriter out;
	String SK;

	String next() throws IOException {
		while ((str == null) || (!str.hasMoreTokens())) {
			SK = in.readLine();
			if (SK == null)
				return null;
			str = new StringTokenizer(SK);
		}
		return str.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	void solve() throws IOException {
		int n = nextInt();
		int m = nextInt();
		boolean[][] was = new boolean[2 * n][2 * n];
		for (int i = 0; i < m; i++) {
			int x = nextInt();
			int y = nextInt();
			was[x][y] = true;
		}
		int[][] res = new int[2 * n][2 * n];
		res[0][0] = 1;
		int mod = (int) (1e+9) + 7;
		int[] size = new int[2 * n + 1];
		size[1] = n;
		for (int i = 2; i <= 2 * n - 1; i++) {
			size[i] = size[i - 1] - 1 + i % 2;
		}
		for (int i = 1; i <= 2 * n - 1; i++) {
			int sum = 0;
			for (int j = 0; j <= 2 * n - 1; j++) {
				res[i][j] = res[i - 1][j];
				int num = (j - i) / 2 + 1;
				if (j >= i && (j % 2 == i % 2) && (!was[num][i])) {
					res[i][j] = (res[i][j] + sum) % mod;
				}
				sum = (sum + res[i - 1][j]) % mod;
			}
		}
		int resul = 0;
		for (int i = 0; i <= 2 * n - 1; i++) {
			resul = (res[2 * n - 1][i] + resul) % mod;
		}
		out.println(resul);
	}

	void run() throws IOException {
		in = new BufferedReader(new FileReader("operators.in"));
		out = new PrintWriter("operators.out");
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new operators_vd().run();
	}
}
