Language: Java

//129
import java.io.*;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class TypicalStairs {
    static final int MOD = 1_000_000_007;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

        int n = in.nextInt();
        int m = in.nextInt();
        Set<Integer> broke = new HashSet<>();
        while (m-- > 0) {
            broke.add(in.nextInt());
        }
        int[] dp = new int[n + 2];
        if (broke.contains(1) && broke.contains(2)) {
            out.println(0);
            out.close();
            return;
        } else if (broke.contains(1)) {
            dp[1] = 0;
            dp[2] = 1;
        } else if (broke.contains(2)) {
            dp[1] = 1;
            dp[2] = 0;
        } else {
            dp[1] = 1;
            dp[2] = 2;
        }

        for (int i=3; i<=n; i++) {
            if (broke.contains(i - 1) && broke.contains(i - 2)) {
                out.println(0);
                out.close();
                return;
            } else if (broke.contains(i - 1)) {
                dp[i] = dp[i - 2];
            } else if (broke.contains(i - 2)) {
                dp[i] = dp[i - 1];
            } else {
                dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
            }
        }
        out.println(dp[n]);
        out.close();
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

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

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

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        public double[] nextDoubleArray(int n) {
            double[] arr = new double[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextDouble();
            }
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        public char[] nextCharArray(int n) {
            char[] arr = nextLine().trim().replaceAll("\\s", "").toCharArray();
            return arr;
        }

        public String[] nextStringArray(int n) {
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = next();
            }
            return arr;
        }
    }
}


Compiler output:
Main.java:7: error: class TypicalStairs is public, should be declared in a file named TypicalStairs.java
public class TypicalStairs {
       ^
1 error