jiahuimbzuai/CoQuIR huggingface dataset:
//  [rust]
use std::io;

fn point(p: i32, xs: &Vec<i32>) -> i32 {
    let it = xs.iter();
    it.map(|x| (p - *x).pow(2)).sum()
}

fn solve(xs: &Vec<i32>) -> i32 {
    (1..101).map(|x| point(x, xs)).min().unwrap()
}

#[test]
fn test_solve() {
    assert_eq!(solve(&vec![1, 4]), 5);
    assert_eq!(solve(&vec![14, 14, 2, 13, 56, 2, 37]), 2354);
}

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let n: usize = input.trim().parse().unwrap();
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let mut iter = input.split_whitespace();
    let xs: Vec<i32> = (0..n).map(|_| { iter.next().unwrap().parse().unwrap() }).collect();
    println!("{}", solve(&xs));
}
//  [rust]
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    let n: i64 = io.read();
    let x = io.readn::<i64>(n as usize);

    let xav = x.iter().fold(0, |sum, x| sum + x) / n;

    let mut ans = 34243242;
    for i in 0..3 {
        let nw = xav + 1 - i;
        let us = x.iter().fold(0, |sum, x| sum + (x - nw) * (x - nw));
        ans = min(ans, us);
    }
    io.writeln(ans);
}

static MOD: i64 = 1000000007;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}
//  [rust]
    let h1 = x.iter().fold(0, |acc, x| acc + (x - n1) * (x - n1));
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    let n: i128;
    let x: Vec<i128>;

    input! {n: i128, x: [i128; n]};

    let mut sum: u128 = 0;

    for i in 1..101 {
        let mut tmp_sum: u128 = 0;
        for j in x.iter() {
            tmp_sum += (j - i).pow(2) as u128;
        }
        if sum == 0 {
            sum = tmp_sum
        } else {
            sum = std::cmp::min(sum, tmp_sum)
        }
    }

    println!("{}", sum);
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    let n: i128;
    let x: Vec<i128>;

    input! {n: i128, x: [i128; n]};

    let mut sum = 0;

    for i in 1..101 {
        let mut tmp_sum: u128 = 0;
        for j in x.iter() {
            tmp_sum += (j - i).pow(2) as u128;
        }
        if sum == 0 {
            sum = tmp_sum
        } else {
            sum = std::cmp::min(sum, tmp_sum)
        }
    }

    println!("{}", sum);
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func getStreth(aryX:[Int],ave:Int) -> Int {
    return aryX.map { Int(pow(Double($0 - ave), 2.0)) }
    .reduce(0) { $0 + $1 }
}

func main() {
    let _ = Int(readLine()!)!
    let aryX = readInts()
    //_____________________________ここまで入力
    
    var ans = Int.max
    var count = 0
    
    while ans > getStreth(aryX: aryX, ave: count) {
        ans = getStreth(aryX: aryX, ave: count)
        count += 1
    }
        
    print(ans)
}

main()
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func getStreth(aryX:[Int],ave:Int) -> Int {
    return aryX.map { Int(pow(Double($0 - ave), 2.0)) }
    .reduce(0) { $0 + $1 }
}

func main() {
    let _ = Int(readLine()!)!
    let aryX = readInts()
    //_____________________________ここまで入力
    
    var ans = 0
    var count = 1
    
    while ans > getStreth(aryX: aryX, ave: count) || ans <= 0{
        ans = getStreth(aryX: aryX, ave: count)
        count += 1
    }
        
    print(ans)
}

main()
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func getStreth(aryX:[Int],ave:Int) -> Int {
    return aryX.map { Int(pow(Double($0 - ave), 2.0)) }
    .reduce(0) { $0 + $1 }
}

func main() {
    let n = Int(readLine()!)!
    let aryX = readInts()
    //_____________________________ここまで入力
    
    var ans = 0
    var count = aryX.reduce(0) { $0 + $1 } / n - 10
    
    while ans > getStreth(aryX: aryX, ave: count) || ans <= 0{
        ans = getStreth(aryX: aryX, ave: count)
        count += 1
    }
        
    print(ans)
}

main()
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func getStreth(aryX:[Int],ave:Int) -> Int {
    return aryX.map { Int(pow(Double($0 - ave), 2.0)) }
    .reduce(0) { $0 + $1 }
}

func main() {
    let n = Int(readLine()!)!
    let aryX = readInts()
    //_____________________________ここまで入力
    
    var ans = 0
    var count = aryX.reduce(0) { $0 + $1 } / n - 1
    
    while ans > getStreth(aryX: aryX, ave: count) || ans <= 0{
        ans = getStreth(aryX: aryX, ave: count)
        count += 1
    }
        
    print(ans)
}

main()
//  [typescript]
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const n: number = tmp[0].split(" ").map(int => parseInt(int))[0];
    const x: number[] = tmp[1].split(" ").map(int => parseInt(int));
    let m: number = 100*100*100;
    for (let i = Math.min.apply(null, x), len = Math.max.apply(null, x); i <= len; i++) {
      let d = 0;
      for (let j = 0; j < n; j++) {
        d += (x[j] - i) * (x[j] - i);
      }
      if (d < m) {
        m = d;
      }
    }
    return `${m}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
import { isRegExp } from "util";

class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  let n=o.n()
  let ar=o.nn(n)
  o.asc(ar)
  let ans =Infinity
  for(let i=1;i<=100;i++){
    let tmp=0;
    for(let j=0;j<ar.length;j++){
      tmp+=(ar[j]-i)**2
    }
    if(ans>tmp)ans=tmp
  }
  o.o(ans)
}
m();
//  [typescript]
import * as fs from 'fs';

//in
// 2
// 1 4
//out
// 5
const main = (inp: string) => {
    // (xi -p)2
    const n = parseInt(inp.split('\n')[0]);
    const x: number[] = inp.split('\n')[1].split(' ').map(Number);
    let ans: number = Number.MAX_VALUE;
    let tmp: number = 0;
    for (let i: number = Math.min(...x); i <= Math.max(...x); i++) {
        tmp = 0;
        for (let j: number = 0; j < n; j++) {
            tmp += (x[j] - i)*(x[j] - i);
        }
        if (ans >= tmp) {
            ans = tmp;
        }
    }
    console.log(ans);
};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());
//  [typescript]
import * as fs from 'fs';

//in
// 2
// 1 4
//out
// 5
const main = (inp: string) => {
    // (xi -p)2
    const n = parseInt(inp.split('\n')[0]);
    const x: number[] = inp.split('\n')[1].split(' ').map(Number);
    let ans: number = Number.MAX_VALUE;
    let tmp: number = 0;
    for (let i: number = 1; i <= n; i++) {
        tmp = 0;
        for (let j: number = 0; j < n; j++) {
            let wk = x[j] - i;
            if (wk <= 0) {
                wk = 0;
            }
            tmp += (wk) ** 2;
        }
        if (ans >= tmp) {
            ans = tmp;
        }
    }
    console.log(ans);
};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());
//  [python]
#!/usr/bin/env pypy
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10 ** 9 + 7


def main():
    n, m = map(int, readline().split())
    # a = readlines()
    As = list(map(int, readlines()))
    # diff_a = [a[i+1] - a[i] for i in range(m - 1)]
    # if 1 in diff_a:
    #     print(0)
    #     return
    broken = [False] * (n + 1)
    for a in As:
        broken[a] = True
    p1, p2 = 1, 1
    if broken[1]:
        p1 = 0

    for i in range(2, n + 1):
        if broken[i]:
            p1, p2 = 0, p1
        else:
            p1, p2 = (p1 + p2) % MOD, p1

    print(p1)


if __name__ == '__main__':
    main()
//  [python]
#!/usr/bin/env python3
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
A = list(map(int, readlines()))
assert len(A) == M

MOD = 10 ** 9 + 7


def solve():
    broken = [False] * (N + 1)
    for a in A:
        broken[a] = True
    p1, p2 = 1, 0
    for i in range(1, N + 1):
        if broken[i]:
            p1, p2 = 0, p1
        elif i == 1:
            p1, p2 = p1, p1
        else:
            p1, p2 = (p1 + p2) % MOD, p1
    return p1


if __name__ == "__main__":
    print(solve())
//  [python]
def main():
  N,M,*alst=map(int, open(0).read().split())
  mod=10**9+7
  if M==0:
    dp = [0] * (N+1)
    dp[:2] = [1, 1]
    for i in range(2, N+1):
      dp[i] = (dp[i-2] + dp[i-1])%mod
    print(dp[N])
    quit()
  tmp=0
  a0=alst[0]
  alst+=[N+1]
  dp = [0] * (N+1)
  dp[:2] = [1, 1 if alst[tmp]!=1 else 0]
  if a0==1:
    tmp=1
  for i in range(2, N+1):
    if i!=alst[tmp]:
      dp[i] = (dp[i-2] + dp[i-1])%mod
    else:
      tmp+=1
  print(dp[N])
main()
//  [python]
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i,n) for (int i = 1; i <= (int)(n); i++)

int main()
{
  int n,m;
  cin >> n >> m;
  
  int a[m];
  cin >> a[0];
  for(int i = 1; i < m; i++)
  {
    cin >> a[i];
    if(a[i] == a[i-1]+1)
    {
      cout << 0 << endl;
      return 0;
    }
  }
  
  int f[n+1];
  ll mod = 1000000007;
  f[0] = 1; f[1] = 1;
  for(int i = 2; i <= n; i++)
  {
    f[i] = f[i-1] + f[i-2];
    f[i] %= mod;
  }
  
  ll ans = 1;
  ll now = 0;
  ll up = 0;
  for(int i = 0; i < m; i++)
  {
    up = a[i] - now;
    ans = (ans % mod) * (f[up-1] % mod);
    ans %= mod;
    now = a[i]+1;
  }
  up = n - now;
  ans *= f[up];
  
  ans %= mod;
  cout << ans << endl;

}
//  [python]
N,M = map(int, input().split())

A = [int(input()) for _ in range(M)]

lis = [0]*(N+1)
lis[0] = 1


for i in range(1,N+1):
    lis[i] = (lis[i-1] + lis[i-2])%(10**9+7)
    if i in A:
        lis[i] = 0

print(lis[N])
//  [java]
import java.util.Scanner;

public class Main {

	static long MOD = 1000000007;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		int[] broken =new int[M];

		for (int i = 0; i < M; i++) {
			broken[i] = sc.nextInt();
		}

		int[] dp=new int[N+1];
		dp[N] = 1;
		for (int i = N-1; i >= 0; i--) {
			boolean judge = false;
			for (int j = 0; j < M; j++) {
				if (broken[j] == i) judge = !judge;
			}
			if (judge) {
				continue;
			}else {
				int con = 0;
				//1段
				if (i+1 <= N) {
					con += dp[i+1] % MOD;
				}
				//2段
				if (i+2 <= N) {
					con += dp[i+2] % MOD;
				}
				dp[i] = Math.max(dp[i], con);
			}
		}

		System.out.println(dp[0]);

	}

}
//  [java]
import java.util.Scanner;
 
public class Main {
	static final long MOD = 1_000_000_007;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		
		boolean[] broken = new boolean[n];
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			a--;
			broken[a] = true;
		}
		
		long[] dp = new long[n];
		dp[0] = broken[0] ? 0 : 1;
		dp[1] = broken[1] ? 0 : 1 + dp[0];
		for (int i = 2 ; i < n; i++) {
			dp[i] = broken[i] ? 0 : (dp[i - 2] + dp[i - 1]) % MOD;
		}
		
//		System.out.println(Arrays.toString(dp));
		
		System.out.println(dp[n - 1]);
		
		sc.close();
	}
}
//  [java]
	import java.util.ArrayList;
	import java.util.Arrays;
	import java.util.Collections;
	import java.util.Comparator;
	import java.util.HashMap;
	import java.util.HashSet;
	import java.util.List;
	import java.util.Map;
	import java.util.Map.Entry;
	import java.util.PriorityQueue;
	import java.util.Queue;
	import java.util.Scanner;
	import java.util.Set;

	public class Main{

		public static void main(String[] args) {

			Scanner scanner = new Scanner(System.in);
			String[] t = scanner.nextLine().split(" ");
			int n = Integer.parseInt(t[0]);
			int m = Integer.parseInt(t[1]);
			HashSet<Integer> set = new HashSet<>();

			for(int i = 0; i < m;i++) {
				set.add(scanner.nextInt() - 1);
			}

			long mod = 1000000007;

			long[] dp = new long[n + 1];
			dp[0] = set.contains(0) ? 0 : 1;
			dp[1] = set.contains(1) ? dp[0] : dp[0] + 1;

			for(int i = 2; i < n; i++) {

				if(!set.contains(i)) {
					dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
				}

			}


			System.out.println(dp[n - 1]);
		}
	}
//  [cpp]
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

ll dp[100002];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), M = getint();
	if (M > N / 2) printf("0");
	else {
		rep(i, M) {
			dp[getint() + 1] = 1;
		}

		dp[0] = 0;
		dp[1] = 1;
		const ll mod = 1e9 + 7;
		int meyasu = 0;
		rep1(i, N) {
			if (!dp[i + 1]) {
				dp[i + 1] = dp[i] + dp[i - 1];
				meyasu++;
				if (meyasu >= 30) {
					dp[i] %= mod;
					dp[i + 1] %= mod;
					meyasu = 0;
				}
			}
			else dp[i + 1] = 0;
		}
		printf("%lld", dp[N + 1] % mod);
	}

	Would you please return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int i=0,j=0,c,n,m,a[100000],dp[100000],MOD=1000000007;
    dp[1]=1;
    dp[2]=2;
    cin >> n >> m;
    for(i=0;i<n;i++)
    {
        cin >> a[i];
        if(a[i]==1)
        {
            dp[1]=0;
            dp[2]=1;
            j=1;
        }
        if(a[i]==2)
        {
            dp[2]=0;
            dp[1]=1;
            j=1;
        }
    }
    a[m]=0;
    for(i=3;i<=n;i++)
    {
        if(a[j]==i)
        {
            dp[i]=0;
            j++;
        }
        else
        {
          dp[i]=(dp[i-1]+dp[i-2])%MOD;  
        }
    }
    cout << dp[n] << endl;
    return 0;

}
//  [cpp]
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
using namespace std;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n,m;
    cin>>n>>m;

    vector<bool> flag(n+1,true);
    for(int i=1;i<=m;i++){
        int a;
        cin>>a;
        flag[a]=false;
    }

    vector<long long> dp(n);
    dp[0]=1;
    dp[1]=1;
    if(!flag[1]){
        dp[1]=0;
    }

    for(int i=2;i<=n;i++){
        dp[i]=dp[i-1]+dp[i-2];
        dp[i]%=1000000007;

        if(!flag[i]){
            dp[i]=0;
        }
    }

    cout<<dp[n]<<"\n";

    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
using namespace std;

vector<bool> flag(10001,true);
vector<long long> mem(10001,-1);

int dp(int n){
    if(n<0){
        return 0;
    }

    if(n==0){
        return 1;
    }

    if(!flag[n]){
        return 0;
    }

    long long sum=dp(n-1)+dp(n-2);
    sum%=1000000007;
    return sum;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n,m;
    cin>>n>>m;

    for(int i=1;i<=m;i++){
        int a;
        cin>>a;
        flag[a]=false;
    }

    cout<<dp(n)<<"\n";

    return 0;
}
//  [c]
// AtCoder ABC129: C - Typical Stairs
// 2019.9.4 bal4u

#include <stdio.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

#define MOD 1000000007
int N;
char f[100005];
int dp[100005];

int main()
{
	int i, M;
	
	N = in(), M = in();
	memset(f, 1, N+1);
	while (M--) f[in()] = 0;
		
	dp[0] = 1; if (f[1]) dp[1] = 1;
	for (i = 2; i <= N; i++) if (f[i]) dp[i] = (dp[i-1] + dp[i-2]) % MOD;
	printf("%d\n", dp[N]);
	return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>

int main(){
    long long n,m,d[100000],a,b=0,p=1;
    scanf("%lld %lld",&n,&m);
    d[0]=1;
    d[1]=1;
    for(int i=2;i<=n;i++){
        d[i]=d[i-1]+d[i-2];
        d[i]%=1000000007;
    }
    for(int i=0;i<m;i++){
        scanf("%lld",&a);
        if(a==b){
            printf("0\n");
            exit(0);
        }
        a=a-1;
        p*=d[a-b];
        p%=1000000007;
        b=a+2;
    }
    p*=d[n-b];
    p%=1000000007;
    printf("%lld\n",p);
    return 0;
}
//  [c]
#include<stdio.h>

typedef long long int ll;

int main(void){
    int M, N;
    int a[100000];
    int br[100000];
    int i = 0;
    int j = 0;
    ll ans = 1;
    ll div=1000000007;
    ll st[100001];

	for(i = 0; i < 100000; i++){
    	a[i] = 0;
    }

  
    scanf("%d %d", &N, &M);
    for(i = 0; i < M; i++){
        scanf("%d", &a[i]);
        if(i != 0 && a[i-1]+1 == a[i]){
            printf("0");
            return 0;
        }
    }

    br[0] = 0;

    for(i = 1; i <= N; i++){
        if(i == a[j]){
            br[i] = 1;
          	j++;
        }else{
            br[i] = 0;
        }
    }

    st[0] = 1;
    if(br[1] == 0){
        st[1] = 1;
    }else{
        st[2] = 2;
    }

    for(i = 2; i <= N; i++){
        if(br[i] == 0){
            if(br[i-1] == 0 && br[i-2] == 0){
                st[i] = st[i-1] + st[i-2];
            }else if(br[i-1] == 1){
                st[i] = st[i-2];
            }else if(br[i-2] == 1){
                st[i] = st[i-1];
            }
          	st[i] = st[i]%div;
            ans = st[i];
        }
    }


    printf("%lld", ans);
    return 0;
}
//  [c]
#include <stdio.h>

int main(void){
  long long n,m,a[200005],sum=0,mod=1000000007,h[200005],jud;                                                             scanf("%lld %lld",&n,&m);                                                                                               for(int i=1;i<=n;i++){                                                                                                    scanf("%lld",&a[i]);                                                                                                    h[a[i]]=0;                                                                                                            }
                                                                                                                           for(int i=1;i<=n;i++){
     if(a[i]==1) jud=-1;
     if(a[i]==2) jud=1;
     if((a[i]==1)&&(a[i]==2)){
       printf("0\n");
       return 0;                                                                                                             }
  }
   if(jud==-1) h[1]=0; h[2]=1;
   if(jud==1) h[1]=1; h[2]=0;
   for(int i=1;i<=n-2;i++){
     if(h[i+2]==0) continue;
     h[i+2]=h[i+1]+h[i];
     h[i+2]%=mod;
   }
   printf("%lld\n",h[n]);                                                                                                 return 0;
 }
//  [c]
#include<stdio.h>
int main()
{
long long int n,m,i;
scanf("%lld %lld",&n,&m);
  long long int ans[n+1],a[m],sw;
  sw=0;
  ans[0]=1;
  
  for(i=0;i<m;++i)
  {scanf("%lld",&a[i]);}
  
  if(a[sw]==1) {ans[1]=0;
               sw++;}
  else ans[1]=1;
  
  for(i=2;i<=n;++i)
  {
  if(i==a[sw]) {ans[i]=0;
                sw++;}
   else
   {
   ans[i]=(ans[i-1]+ans[i-2])%1000000007;
   }
  }
  printf("%lld",ans[n]);

return 0;}
//  [c]
#include <stdio.h>
#define max(x, y) ((x)<(y) ? (y) : (x))

int main(){
  long mod = 1e9+7;
  int n, m;  scanf("%d %d", &n, &m);
  int a[100005] = {0}; a[m+1] = n+1;  a[0] = -10000;
  for(int i=1; i<=m; i++){
    scanf("%d", a+i);
    if(a[i] - a[i-1] <= 1){
      printf("0\n");
      return 0;
    }
  }
  if(a[m+1] - a[m] <= 1){ printf("0\n"); return 0; }
  a[0] = 1;
  int now = 0, b[100005] = {0}, maxi = 0;
  for(int i=1; i<=m+1; i++){
    b[i] = a[i] - 1 - now;
    maxi = max(maxi, b[i]);
    now = a[i] + 1;
  }

  long fibo[100005] = {0};  fibo[1] = fibo[0] = 1;
  for(int i=2; i<=maxi; i++)
    fibo[i] = fibo[i-1] + fibo[i-2];

  long ans = 1;
  for(int i=1; i<=m+1; i++)
    if(b[i])
      ans = (ans * fibo[b[i]]) % mod;


  printf("%ld\n", ans);
  return 0;
}
//  [javascript]
"use strict";
const main = input => {
    let n = parseInt(input[0].split(' ')[0],10), m = parseInt(input[0].split(' ')[1],10);
    let arr = new Array(n+1),a=0;
    arr[0] = 1,arr[1] = 1;
    for(let i=0; i<m; i++) {
        a = parseInt(input[i+1],10);
        arr[a] = 0;
    }
    for(let i=2; i<n+1; i++) {
        if (arr[i]!=0) {
            arr[i] = (arr[i-1]+arr[i-2])%1000000007;
        }
    }
    // console.log(arr);
        
    console.log(arr[n]);
    
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));
//  [javascript]
const main = (inputs) => {
  var mod = 1000000007;

  var N = inputs[0].split(" ")[0]-0;
  var M = inputs[0].split(" ")[1]-0;
  var ana = {};
  for(var i=1;i<=M;i++){
    ana[inputs[i]] = true;
    if(i>1 && inputs[i] - inputs[i-1] == 1) {console.log(0);return;}
  }
  var map = {
    0: 1,
    1: (ana[1]?0:1)
  };
  for(var i=2;i<=N;i++){
    if(ana[i]) continue;
    map[i] = (map[i-1]||0) + (map[i-2]||0);
    map[i] = map[i]%mod;
  }
  console.log(map[N]);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));
//  [javascript]
'use strict'

const INF = 900719925474099;
function mapint(temp){
    return temp.split(' ').map((v)=>parseInt(v));
}
const MOD = 1000000007;

function Main(input){
    let temp = input.trim().split('\n');
    let n = mapint(temp[0])[0];
    let m = mapint(temp[0])[1];
    let a = new Array(m);

    let step = new Array(n+10).fill(0);
    step[0] = 1;

    for(let i=1;i<=m;i++){
        step[parseInt(temp[i])] = -1;
    }

    for(let i=0;i<n;i++){
        if(step[i] == -1) continue;
        if(step[i+1] != -1){
            step[i+1]+=step[i];
            step[i+1]%=MOD;
        }
        if(step[i+2] != -1){
            step[i+2]+=step[i];
            step[i+2]%=MOD;
        }
        //console.log(step);
    }

    console.log(step[n]);

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function spilitInput(input, to_int) {
  if (typeof to_int === 'undefined') to_int = false;
  var splited = [];
  var rows = input.split('\n');
  for (var i = 0; i < rows.length; i += 1) {
    if (to_int) {
      splited.push(rows[i].split(' ').map(function(d){return parseInt(d,10);}));
    } else {
      splited.push(rows[i].split(' '));
    }
  }
  return splited;
}

function initDp(N, init_n) { return Array(N+2).fill(init_n); }
function chmin(a, b) { if (a > b) a = b; }
function chmax(a, b) { if (a < b) a = b; }

function Main(input) {
  var splited = spilitInput(input, true);
  var N = splited[0][0];
  var hasons = [];
  for (var i = 1; i < splited.length; i += 1) {
    hasons.push(splited[i][0]);
  }
    
  var dp = initDp(N, 0);
  dp[0] = 1;
  
  for (var i = 1; i <= N; i += 1) {
    if (hasons.indexOf(i) !== -1) continue;
    dp[i] += dp[i - 1];
    if (i >= 2) dp[i] += dp[i - 2];
    dp[i] %= 1000000007;
  }

  console.log(dp[N]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function spilitInput(input, to_int) {
  if (typeof to_int === 'undefined') to_int = false;
  var splited = [];
  var rows = input.split('\n');
  for (var i = 0; i < rows.length; i += 1) {
    if (to_int) {
      splited.push(rows[i].split(' ').map(function(d){return parseInt(d,10);}));
    } else {
      splited.push(rows[i].split(' '));
    }
  }
  return splited;
}

function initDp(N, init_n) {
  var dp = [];
  for (var i = 0; i <= N; i += 1) { dp.push(0);}
  return dp;
}
function chmin(a, b) { if (a > b) a = b; }
function chmax(a, b) { if (a < b) a = b; }

function Main(input) {
  var splited = spilitInput(input, true);
  var N = splited[0][0];
  var hasons = [];
  for (var i = 1; i < splited.length; i += 1) {
    hasons.push(splited[i][0]);
  }
    
  var dp = initDp(N, 0);
  dp[0] = 1;
  
  for (var i = 1; i <= N; i += 1) {
    if (hasons.indexOf(i) !== -1) continue;
    dp[i] += dp[i - 1];
    if (i >= 2) dp[i] += dp[i - 2];
    dp[i] %= 1000000007;
  }

  console.log(dp[N]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function spilitInput(input, to_int) {
  if (typeof to_int === 'undefined') to_int = false;
  var splited = [];
  var rows = input.split('\n');
  for (var i = 0; i < rows.length; i += 1) {
    if (to_int) {
      splited.push(rows[i].split(' ').map(function(d){return parseInt(d,10);}));
    } else {
      splited.push(rows[i].split(' '));
    }
  }
  return splited;
}

function initDp(N, init_n) {
  var dp = [];
  for (var i = 0; i <= N; i += 1) { dp.push(0);}
  return dp;
}
function chmin(a, b) { if (a > b) a = b; }
function chmax(a, b) { if (a < b) a = b; }

function Main(input) {
  var splited = spilitInput(input, true);
  var N = splited[0][0];
  var hasons = [];
  for (var i = 1; i < splited.length; i += 1) {
    hasons.push(splited[i][0]);
  }
    
  var dp = initDp(N, 0);
  dp[0] = 1;
  
  for (var i = 1; i <= N; i += 1) {
    if (hasons.indexOf(i) !== -1) continue;
    dp[i] += dp[i - 1];
    if (i >= 2) dp[i] += dp[i - 2];
    dp[i] = parseInt((dp[i] % 1000000007), 10);
  }

  console.log(dp[N]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
	// "sort"
)

var stdin = initStdin()
 
func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func scanInt() int {
	stdin.Scan()
	i, _ := strconv.Atoi(stdin.Text())
	return i
}

func scanStr() string {
	stdin.Scan()
	return stdin.Text()
}

type ia []int

func (ia ia)Len() int {
	return len(ia)
}
func (ia ia)Swap(i, j int) {
	ia[i], ia[j] = ia[j], ia[i]
}
func (ia ia)Less(i, j int) bool {
	return ia[i] < ia[j]
}

const inf = 1000000000 + 7

var fib = []int {1, 1, 2, 3, 5, 8}
var fibCount = 6

func mFib(req int) int {
	if req <= fibCount {
	} else {
		lo := req - fibCount
		for i := 0; i < lo; i++ {
			fib = append(fib, (fib[fibCount-2]+fib[fibCount-1])%inf )
			fibCount++
		}
	}
	return fib[req-1]
}


func main() {
	n := scanInt()
	m := scanInt()
	bef := -1
	ans := 1
	a := 1
	for i := 0; i < m; i++ {
		a = scanInt()
		diff := a - bef
		if diff < 2 {
			ans = 0
			break
		}
		ans *= mFib(diff-1)
		ans %= inf
		bef = a
	}
	ans *= mFib(n - bef)
	ans %= inf
	fmt.Println(ans)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

const inf = 1 << 60
const mod int = 1e9 + 7

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n, m := ri(), ri()

	dp := make([]int, n+1)

	a := make([]int, m)
	for i := 0; i < m; i++ {
		a[i] = ri()
		dp[a[i]] += -1
	}

	dp[0] = 1
	if dp[1] != -1 {
		dp[1] = 1
	}

	for i := 2; i < len(dp); i++ {
		if dp[i] == -1 {
			continue
		}
		var x, y int
		if dp[i-2] != -1 {
			x = dp[i-2]
		} else {
			x = 0
		}
		if dp[i-1] != -1 {
			y = dp[i-1]
		} else {
			y = 0
		}
		dp[i] = (x + y) % mod
	}

	fmt.Println(dp[n])
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	xs := make([]int, n+1)
	for i := range xs {
		xs[i] = 1
	}
	var (
		sc = bufio.NewScanner(os.Stdin)
		a  int
	)
	for i := 0; i < m; i++ {
		sc.Scan()
		a, _ = strconv.Atoi(sc.Text())
		xs[a] = 0
	}
	var (
		f2     = 1
		f1, f0 = xs[1], xs[0]
	)
	for i := 2; i <= n; i++ {
		f2 = (f1*xs[i-1] + f0*xs[i-2]) % mod
		f1, f0 = f2, f1
	}
	fmt.Println(f2)
}
//  [ruby]
MOD = 1000000007
def fib(n)
	#return n+1>>1 if n<4
	return ((0.5+Math.sqrt(5)*0.5)**n/Math.sqrt(5)).round % MOD if n<70
	nb = n.bit_length-6;a=((0.5+Math.sqrt(5)*0.5)**(n>>nb)/Math.sqrt(5)).round;b=(a+a*Math.sqrt(5)).round>>1
	(nb-1).downto(0){|m|a,b=a*(2*b-a)%MOD,(b*b+a*a)%MOD;a,b=b,a+b if (n>>m).odd?}
	return a
end

def mypow(a,m)
	return a**m%MOD if m<4;c,res=a,1;while(m>0);res=res*c%MOD if m.odd?;c,m=c*c%MOD,m>>1;end;return res
end

N, M = gets.split.map(&:to_i)
exit p(0) if M*2 > N
res = 1
$<.map(&:to_i).unshift(-1).push(N+1).each_cons(2).map{|x,y|y-x}.group_by(&:pred).each{|x,y|res=res*mypow(fib(x),y.size)%MOD}
p res
//  [ruby]
mod = 10**9+7
mod2 = mod * 5

n, m = gets.to_s.split
n, m = n.to_i, m.to_i

A = $<.map &:to_i

if A.each_cons(2).any?{|a, b| b - a == 1 }
  p 0
  exit
end

stairs = [1] * (n+1)

A.each do |a|
  stairs[a] = 0
end

2.upto(n) do |i|
  next if stairs[i] == 0
  stairs[i] = stairs[i-1] + stairs[i-2]
  stairs[i] %= mod if stairs[i] > mod2
end

puts stairs[-1] % mod
//  [ruby]
N, M  = gets.split.map &:to_i
A = $<.map &:to_i
MOD = 10**9+7
if A.each_cons(2).any?{|a, b| b - a == 1 }
  p 0
  exit
end
NG = [false] * (N + 1)
A.each{|a| NG[a] = true }

dp = [0] * (N + 1)
dp[0] = 1

(1..N).each{|to|
  next if NG[to]
  from_1 = to - 1 >= 0 ? dp[to - 1] : 0
  from_2 = to - 2 >= 0 ? dp[to - 2] : 0
  dp[to] = (from_1 + from_2) % MOD
}
p dp[N]
//  [ruby]
n,m = gets.split.map(&:to_i)
a = []
m.times { a << gets.to_i }
dp = [1,1]
dp[1] = 0 if a.include? 1
(2..n).each do |i|
  dp[i] = dp[i-1] + dp[i-2]
  dp[i] = 0 if a.include? i
end
p dp[n] % 1000000007
//  [ruby]
N, M = gets.chomp.split().map(&:to_i)

danger = []
M.times do
  danger << gets.chomp.to_i
end

dp = [0] * (N+1)
dp[0] = 1
if danger[0] == 1
  dp[1] = 0
  danger.shift
else
  dp[1] = 0
end

for i in 2..N do
  if i == danger[0]
    dp[i] = 0
    danger.shift
  else
    dp[i] = dp[i-1] + dp[i-2]
  end
end

puts dp[-1] % 1000000007
//  [ruby]
N, M = gets.chomp.split().map(&:to_i)

danger = []
M.times do
  danger << gets.chomp.to_i
end

dp = [0] * (N+1)
dp[0] = 1
dp[1] = danger.include?(1) ? 0 : 1

for i in 2..N do
  if danger.include?(i)
    dp[i] = 0
  else
    dp[i] = dp[i-1] + dp[i-2]
  end
end

puts dp[-1] % 1000000007
//  [rust]
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let md = 1_000_000_007;
    let n = get!(usize);
    let m = get!();
    let mut cur = 0;
    let mut dp = vec![0; n+3];
    dp[cur] = 1;
    for _ in 0..m {
        let a = get!(usize);
        if cur == a {
            println!("0");
            return;
        }
        for i in cur..a {
            dp[i+1] = (dp[i+1] + dp[i]) % md;
            dp[i+2] = (dp[i+2] + dp[i]) % md;
        }
        cur = a + 1;
    }
    for i in cur..n {
        dp[i+1] = (dp[i+1] + dp[i]) % md;
        dp[i+2] = (dp[i+2] + dp[i]) % md;
    }
    println!("{}", dp[n]);
}
//  [rust]
use proconio::{input, fastout};
use std::usize::MAX;

const MOD: usize = 1_000_000_007;

fn dp(step_cnt: &mut Vec<usize>, steps: usize) -> usize {
    if step_cnt[steps] != MAX { return step_cnt[steps]; }
    step_cnt[steps] = ( dp(step_cnt, steps-1) + dp(step_cnt, steps-2) ) % MOD;
    step_cnt[steps]
}

#[fastout]
fn main() {
    input! {
        n: usize, m: usize,
        broken: [usize; m],
    }

    let mut step_cnt: Vec<usize> = vec![MAX; n];
    step_cnt[0] = 1;
    step_cnt[1] = 1;
    step_cnt[2] = 2;

    let mut ans = 1;
    let mut last_idx = 0;
    let mut it = broken.iter();
    let f = it.next();
    match f {
        None => (),
        Some(1) => { last_idx = 1 },
        Some(i) => {
            ans = dp(&mut step_cnt, i-last_idx-1);
            last_idx = *i
        },
    }
    for i in it {
        if i-last_idx==1 { ans=0; break }
        ans = ans * dp(&mut step_cnt, i-last_idx-2) % MOD;
        last_idx = *i;
    }
    ans = ans * dp(&mut step_cnt, n-last_idx-1) % MOD;

    println!("{}", ans);
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        a: [u128; m]
    };
    let a: Vec<u128> = a;

    let base = (10i32.pow(9) + 7) as u128;
    let mut result = 1;

    let f = |x: u128| -> u128 {
        if x <= 2 {
            return 1;
        } else {
            let n = x - 2;
            let i = 2;
            let tmp = (n * (n - 1)) / 2;

            return i + tmp;
        }
    };

    let mut prev = n as u128;

    for i in 0..=m {
        if i < m {
            if prev + 1 == a[i] {
                result = 0;
                break;
            }
        }

        if i == 0 {
            let x = a[i];
            let r = f(x);
            result *= r;
            result %= base;
            prev = a[i];
        } else if i == m {
            let x = n as u128 - a[m as usize - 1];
            let r = f(x);
            result *= r;
            result %= base;
        } else {
            let x = a[i] - a[i - 1] - 1;
            let r = f(x);
            result *= r;
            result %= base;
            prev = a[i];
        }
    }

    println!("{}", result % base);
}
//  [rust]
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let MOD: i64 = 1000000007;
    let n:usize = read();
    let m:usize = read();
    let mut dp:Vec<i64> = vec![0;n + 1];
    for i in 0..m{
        let a:usize = read();
        dp[a] = -1;
    }
    dp[0] = 1;
    for i in 1..n + 1{
       if dp[i] != -1 && dp[i - 1] != -1 {
           dp[i] += dp[i - 1];
           dp[i] %= MOD;
       }
           if i > 1  && dp[i] != -1 && dp[i - 2] != -1{
               dp[i] += dp[i - 2];
               dp[i] %= MOD;
           }
    }
    println!("{:?}",dp);
    println!("{}",dp[n]);
}
//  [swift]
import Foundation

func readWords<T>(_ f: (Substring) -> T) -> [T] {
    return readLine()!.split(separator: " ").map(f)
}


func main() {
    let nm = readWords { Int($0)! }
    let n = nm[0]
    let m = nm[1]
    let mod = 1_000_000_007

    var dp = Array(repeating: 0, count: n+1)
    dp[0] = 1

    var safe = Array(repeating: true, count: n+1)

    for _ in 0..<m {
        let a = Int(readLine()!)!
        safe[a] = false
    }

    for i in 0..<n {
        if i+1 <= n && safe[i+1] {
            dp[i+1] += dp[i]
            dp[i+1] %= mod
        }

        if i+2 <= n && safe[i+2] {
            dp[i+2] += dp[i]
            dp[i+2] %= mod
        }
    }
    print(dp.last!)
}

main()
//  [swift]
let inp = readLine()!.split(separator: " ").map { Int($0)! }

let n = inp[0]
let m = inp[1]

let mod = 1000000007

var banned = Set<Int>()

for _ in 0..<m {
  let a = Int(readLine()!)!
  banned.insert(a)
}

var dp: [Int] = .init(repeating: 0, count: n + 1)

dp[0] = 1
for i in 1...n {
  if banned.contains(i) {
    continue
  }
  dp[i] = dp[i-1] + (i - 2 < 0 ? 0 : dp[i-2])
  dp[i] %= mod
}
print(dp[n] % mod)
//  [swift]
import Foundation

let args = readLine()!.split(separator: " ")
let N = Int(args[0])!
let M = Int(args[1])!
let a = [Int](unsafeUninitializedCapacity: M) { buffer, _ in
    for m in 0 ..< M {
        buffer[m] = Int(readLine()!)!
    }
}

var step = 0
var s1 = 1
var s2 = 0

var n = N - 1
var m = M - 1
while 0 <= n {
    let isStepBroken = 0 <= m && a[m] == n
    if isStepBroken {
        step = 0
        m -= 1
    } else {
        step = (s1 + s2) % 1_000_000_007
    }
    s2 = s1
    s1 = step
    n -= 1
}
let answer = step

print(answer)
//  [swift]
import Foundation

// Example1
//let N = 6
//let M = 1
//let a = [3]

// Example2
//let N = 10
//let M = 2
//let a = [4, 5]

// Example3
//let N = 100
//let M = 5
//let a = [1, 23, 45, 67, 89]

let array = readLine()!.split(separator: " ")
let N = Int(array[0])!
let M = Int(array[1])!
var a = [Int](repeating: 0, count: M)
for m in 0 ..< M {
    a[m] = Int(readLine()!)!
}

/*
 Example1:
 ---------------------
 n | N1, N2 | S
 ---------------------
 0 |  1,  2 | 2 + 2 -> 4
 1 |  2,  3 | 2 + 0 -> 2
 2 |  3,  4 | 0 + 2 -> 2
 3 |  7,  7 | 0 + 0 -> 0
 4 |  5,  6 | 1 + 1 -> 2
 5 |  6,  7 | 1 + 0 -> 1
 6 |                   1 ; goal
 7 |                   0 ; over or broken
*/

var N1 = [Int](repeating: 0, count: N)
var N2 = [Int](repeating: 0, count: N)
var S = [Int](repeating: 0, count: N + 2)
S[N] = 1
S[N + 1] = 0

var m = 0

for n in 0 ..< N {
    let isStepBroken = m < M && a[m] == n
    if isStepBroken {
        N1[n] = N + 1
        N2[n] = N + 1
        m += 1
    } else {
        N1[n] = n + 1
        N2[n] = n + 2
    }
}
for n in (0 ..< N).reversed() {
    S[n] = S[N1[n]] + S[N2[n]]
}
let answer = S[0] % 1_000_000_007

print(answer)
//  [swift]
import Foundation

func readWords<T>(_ f: (Substring) -> T) -> [T] {
    return readLine()!.split(separator: " ").map(f)
}


func main() {
    let nm = readWords { Int($0)! }
    let n = nm[0]
    let m = nm[1]
    let mod = 1_000_000_007

    var dp = Array(repeating: 0, count: n+1)
    dp[0] = 1

    var safe = Array(repeating: true, count: n+1)

    for _ in 1...m {
        let a = Int(readLine()!)!
        safe[a] = false
    }

    for i in 0..<n {
        if i+1 <= n && safe[i+1] {
            dp[i+1] += dp[i]
            dp[i+1] %= mod
        }

        if i+2 <= n && safe[i+2] {
            dp[i+2] += dp[i]
            dp[i+2] %= mod
        }
    }
    print(dp.last!)
}

main()
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
// 
const main=()=>{
  let [n,m]=tnn(2),mr=tnn(m),dp=new Array(n+1),x=1000000007
  dp[n]=1;
  dp[n-1]=1;
  for(let j=0;j<mr.length;j++){
    dp[mr[j]]=0
    if(mr[j]==mr[j+1]-1){
      to(0)
      return
    }
  }
  for(let i=n-2;i>=0;i--){
    if(dp[i]!=0)dp[i]=(dp[i+1]+dp[i+2])%x
  }
  to(dp[0])
}
main()
//  [typescript]
{
  const _mod = 10 ** 9 + 7

  const main = (input: string) => {
    const r = reader(input)
    const [n, _m] = r.ns()
    const a = r.nls()

    const dp: number[] = Array(n + 1)

    dp.fill(0)
    a.forEach(ai => (dp[ai] = -1))
    dp[0] = 1

    for (let i = 0; i < n; i++) {
      // console.log(dp.join(' '))
      if (dp[i] === -1) continue

      if (dp[i + 1] !== -1) {
        dp[i + 1] = (dp[i + 1] + dp[i]) % _mod
      }
      if (dp[i + 2] !== -1) {
        dp[i + 2] = (dp[i + 2] + dp[i]) % _mod
      }
    }
    console.log(dp[n])
  }

  const reader = (str: string) => {
    const lines = str.trim().split('\n')
    const s = () => lines.shift() || ''
    const n = () => Number(s())

    const ss = () => s().split(' ')
    const ns = () => ss().map(Number)
    const nls = () => lines.map(Number)

    return { lines, s, n, ss, ns, nls }
  }

  const getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')

  main(getInput())
}
//  [typescript]
'use strict'
const main = (input: string) => {
    // DP法苦手すぎて解説読んだ
    const std: string[] = input.split('\n')
    const [n, m] = std.shift().split(' ').map(Number)
    const holes: number[] = std.map(Number)
    let dp: number[] = []
    dp[0] = 1
    dp[1] = 1
    holes.forEach(v => dp[v] = 0)
    for (let i = 2; i <= n; i++) {
        if (dp[i] === 0) continue
        dp[i] = (dp[i-1] + dp[i-2]) % 1000000007
    }
    console.log(dp[n])
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
// 
const main=()=>{
  let [n,m]=tnn(2),mr=tnn(m),dp=new Array(n+1),x=1000000007
  for(let j=0;j<mr.length-1;j++){
    if(mr[j]==mr[j+1]-1){
      to(0)
      return
    }
  }
  dp[n]=1;
  dp[n-1]=1;
  for(let i=n-2;i>=0;i--){
    let f=0
    for(let j=0;j<mr.length;j++){
      if(i==mr[j]){
        f=1
        dp[i]=0
        break
      }
    }
    if(!f)dp[i]=(dp[i+1]+dp[i+2])%x
  }
  to(dp[0])
}
main()
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let [n,m]=tnn(2),mr=tnn(m),dp=new Array(n+1),x=1000000007
  dp[0]=1,dp[1]=1
  for(let j=0;j<mr.length-1;j++){
    if(mr[j]==mr[j+1]-1){
      to(0)
      return
    }
  }
  for(let i=2;i<=n;i++){
    let f=0
    for(let j=0;j<mr.length;j++){
      if(i==mr[j]){
        f=1
        dp[i]=dp[i-1]
        if(n>=i+1)dp[i+1]=dp[i-1]
        if(n>=i+2)dp[i+2]=dp[i-1]
        i+=2
        mr.pop()
        break
      }
    }
    if(!f)dp[i]=(dp[i-2]+dp[i-1])%x
  }
  to(dp[n])
}
main()